Archived Boards > WinBatch Dynamic Dialogs

Invoke a Dialog Callback Procedure From Within a Dialog Callback Procedure?

<< < (2/6) > >>

td:

--- Quote from: USMuscle on August 11, 2016, 08:54:04 am ---So are you saying I could have placed the Child dialog lines in a Label OUTSIDE of the Parent Subroutine, below the Parent dialog lines, and simply used a GoSub from within the Parent Subroutine?

--- End quote ---
No, I did not say that.  It is not necessary to use a label and a 'gosub' when using a WIL dialog. However, you can, if you feel compelled to do so for some reason.  What I said was that the a dialog's templates variables must be instantiated and in scope before you call the Dialog function to display the dialog associated with that template.  UDFs and UDS's are globally visible once defined so you simply need to make sure that any callback UDF or UDS is defined before you call the Dialog function that displays the dialog that uses the UDF or UDS as a callback.

--- Quote --- If that's the case, could I then place the defined Child Subroutine below the Parent dialog lines, directly above the Child dialog lines, or must I leave the defined Child Subroutine ABOVE the Parent Subroutine?

--- End quote ---

See above.  Or wait for someone with more patience to do a better job of explaining it.

USMuscle:
I guess my problem is that I'm not sure how else I can "call" the Child dialog from within the Parent UDS without placing the dialog element lines inside the Parent UDS. That's why I was wondering about the GoSub.

As I tried to depict in my previous example structure, I want someone to be able to press a button in the Parent dialog that brings up the Child dialog. I didn't know how else to get the Child dialog to display without placing the Child dialog lines themselves within the Parent UDS. It is definitely unwieldly looking at a structure like what I have now, and since you said I didn't have to do that, can you offer some guidance as to an alternative I might use to call up the Child dialog instead of me having the Child dialog lines in the Parent UDS?

Thanks again.

td:

--- Quote from: USMuscle on August 11, 2016, 12:30:34 pm ---I guess my problem is that I'm not sure how else I can "call" the Child dialog from within the Parent UDS without placing the dialog element lines inside the Parent UDS. That's why I was wondering about the GoSub.

--- End quote ---

It's very simple.  Just use the cut and paste functionality of your editor of choice to move the 'child' template out of the 'parent' UDS and into the main body of your script.  Just remember to put it someplace before the 'parent' dialog's Dialog function gets called.
 

--- Quote ---As I tried to depict in my previous example structure, I want someone to be able to press a button in the Parent dialog that brings up the Child dialog. I didn't know how else to get the Child dialog to display without placing the Child dialog lines themselves within the Parent UDS. It is definitely unwieldly looking at a structure like what I have now, and since you said I didn't have to do that, can you offer some guidance as to an alternative I might use to call up the Child dialog instead of me having the Child dialog lines in the Parent UDS?

Thanks again.

--- End quote ---

What you are trying to do has been understood from the beginning and all of the responses have been a modest attempt to provide guidance toward that end...  Perhaps you need a better 'explainer'.

JTaylor:
Hopefully I am understanding the problem/question....Perhaps the following will help.   It is one option and I *think* what Tony was trying to get across. 

What I have done is write a processing script which integrates Dialog code into my script when I am ready to compile it.   I just use a Call() on the dialog file while developing and don't really care how ugly the code is at compile time.  This avoids a lot of hassle with editing dialogs and having to copy/paste them into my scripts.

Jim

#DefineSubroutine Child1_Dialog.........
....................
....................
#EndSubroutine


#DefineSubroutine Child1_Callback.........
....................
....................
#EndSubroutine

#DefineSubroutine Parent_Callback.........
....................
...................
     Case [Control Number for Button]
        Child1_Dialog()

#EndSubroutine

Parent Dialog
[Parent Dialog lines]
[Parent Dialog Lines]

JTaylor:
Also, MAKE SURE you do not use the same dialog variable name for both dialogs....that doesn't work very well.

Jim

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version