PDA

View Full Version : Events in Loop Wizard



Chris
06-11-2012, 02:21 PM
I have half a dozen Define Wizard Dialogs
and then Loop Wizard

What event (or other method) can I use to detect when a user has pressed NEXT on a dialog to move to the next dialog (so I can check the user's choices and decide whether or not to show the next dialog) ?

linder
06-11-2012, 11:59 PM
Chris,

See attached screenshot from the example that I uploaded for you some days ago ;)

Friedrich

Chris
06-12-2012, 07:30 AM
Thanks, yes, tried that but it did not seem to work for me.

Also, are you saying that when user press NEXT button on Dialog1, I can catch this by looking at when Dialog2 starts?
I need to catch the NEXT button on Dialog1, to decide if dialog2 should be shown or hidden.


I have found that the EVENT:ONUPDATE does seem to be triggered when NEXT is pressed, and at the moment this does seem to work for what I want. Could you confirm what things trigger EVENT:ONUPDATE ? eg. if a checkbox or radio button is clicked? Or NEXT or PREVIOUS button clicked?


Usually my criticism of software products is that they give only brief reference descriptions of what functions/events/etc do, and do not provide examples.
SetUpBuilder has plenty of excellent examples which is good. But I seem to need a bit more explanation about the functions and events etc used in the examples. eg. as question above.

linder
06-12-2012, 07:37 AM
Chris,

I would strongly suggest to read the "Learning SetupBuilder Part I" again ;) All this is explained very well in the manual and in the Examples.

I'll develop a simple demo for you...

BTW, the EVENT:ONUPDATE is fired for custom dialogs only!

Friedrich

linder
06-12-2012, 07:54 AM
Okay, here we go...

http://www.lindersoft.com/projects/Chris3.zip

Hope this helps.

Friedrich

linder
06-12-2012, 08:01 AM
Usually my criticism of software products is that they give only brief reference descriptions of what functions/events/etc do, and do not provide examples.
SetUpBuilder has plenty of excellent examples which is good. But I seem to need a bit more explanation about the functions and events etc used in the examples. eg. as question above.

Please see "Learning SetupBuilder Part I" (Example Files section).

Friedrich

Chris
06-12-2012, 09:45 AM
>> All this is explained very well in the manual and in the Examples.
>> BTW, the EVENT:ONUPDATE is fired for custom dialogs only!
Well it is useful to know that ONUPDATE is only for custom dialogs. That is the sort of vital information I cannot find explained in the manual. :-)

The examples are great -- BUT when I try to change something and find it does not work, I need to ask questions. This is probably because I am a programmer and trying to understand the syntax of the commands.

Chris
06-12-2012, 09:51 AM
Perhaps I should just ask one question per post :-)

If I have two dialogs, Dialog1 and Dialog2,

What event or variable do I use so that when user clicks NEXT on Dialog1
I can decide whether to show or hide Dialog2 ?

Chris
06-12-2012, 12:24 PM
I have been playing with the example Custom dialog Demo 1
and I seem to find that the variable %_SB_BUTTONID% retains its value from one Dialog to the next.

>> click NEXT, the variable %_SB_BUTTONID% returns $NEXT_BTN$.

I guess this makes sense since it is just a variable rather than an Event.
If this is true, it probably explains all the problems I have been having :-)
If this is true, then I guess I need to set this (and other??) variables to "" at some point in the Loop Wizard?

Chris
06-12-2012, 12:34 PM
>>> click NEXT, the variable %_SB_BUTTONID% returns $NEXT_BTN$.

It seems the variable %_SB_BUTTONID% is set to $NEXT_BTN$ even before the each dialog appears, even if I set it to nothing in between.
So my test "If variable %_SB_BUTTONID% equals $NEXT_BTN$" is always true, which somewhat lessens its usefulness :-(

(Though it also DOES get triggered when I DO press the Next button :-)

linder
06-12-2012, 11:39 PM
Did you download the example (Chris3.zip) I developed for you? It demonstrates this scenario! You click NEXT on Dialog #3 and you decide whether to show hide Dialog #4.

Friedrich

linder
06-13-2012, 12:05 AM
No. %_SB_BUTTONID% is set to $NEXT_BTN$ after the user clicked NEXT. If the next dialog (to be displayed) is a custom wizard dialog, %_SB_BUTTONID% is also set to $NEXT_BTN$ when the $EVENT:ONINIT$ or $EVENT:ONREOPEN$ events are fired. And %_SB_BUTTONID% is set to $NEXT_BTN$ when a control (e.g. a checkbox or button) fires an event on a custom wizard dialog.

We'll add this information to the documentation.

Just curious, why do you handle %_SB_BUTTONID% at all?

Friedrich

linder
06-13-2012, 12:06 AM
If this is true, then I guess I need to set this (and other??) variables to "" at some point in the Loop Wizard?

No, don't do this!

Friedrich

Chris
06-13-2012, 03:41 AM
Sorry, I read the Chris3.zip on the screen and thought I understood it. But now I have downloaded it I find it does exactly what I need -- THANKYOU --
But I still don't understand it.

How often does the Loop Wizard go round the loop? My guess is each time any button or control (eg checkbox) is clicked??

What does CYCLE LOOP do? (PDF says it passes control to the top of the loop). My guess is "Top of the Loop" means it is then waiting for a button to be pressed before it goes round the loop again??



>>> Just curious, why do you handle %_SB_BUTTONID% at all?
Searched Forum for how to detect NEXT button. Found example which shows %_SB_BUTTONID% used. Thought that was the method I needed.

linder
06-13-2012, 04:17 AM
For "standard" wizard dialogs, the Loop Wizard goes round the loop once when the Next or Back button is pressed.

For "custom" wizard dialogs, the Loop Wizard goes round the loop when the Next or Back button is pressed -- and: 1.) if the "Disable EVENT:ONINIT" option is not marked, when the dialog gets "initialized", 2.) when the dialog is "re-displayed" (e.g. after a BACK/NEXT button combination), 3.) when a control fires an event (e.g. checkbox marked/unmarked).

A Cycle Loop statement passes control immediately back to the top of the Loop. See attached screenshot. In this case, the password is not valid and the installer displays a message box. After that, it goes immediately back to the top of the Loop (and "HELLO WORLD!" is not displayed).

HTH,

Friedrich

Chris
06-13-2012, 04:45 AM
Thank you for your help.

linder
06-13-2012, 05:16 AM
You are very welcome!!

Friedrich