PDA

View Full Version : How to detect when a button has been pressed



NewsArchive
10-10-2011, 12:34 AM
Take the Install Folder window for example, how can I detect when the Back,
Next, Cancel or Change buttons are pressed and code something to do at that
point.

For example, whenever Back is pressed I need to reset a variable to a
default value. Equally when Next or Change is pressed I need to append a
value to the install folder selected.

I can use Set Focus to ControlID $edit_Data1$ for example, but this is not
the same as detecting a button has been actioned.

TIA

John Fligg

NewsArchive
10-10-2011, 12:34 AM
John,

> Take the Install Folder window for example, how can I detect when the
> Back, Next, Cancel or Change buttons are pressed and code something to do
> at that point.
>
> For example, whenever Back is pressed I need to reset a variable to a
> default value. Equally when Next or Change is pressed I need to append a
> value to the install folder selected.
>
> I can use Set Focus to ControlID $edit_Data1$ for example, but this is not
> the same as detecting a button has been actioned.

If you press BACK, the variable %_SB_BUTTONID% returns $BACK_BTN$ and if you
click NEXT, the variable %_SB_BUTTONID% returns $NEXT_BTN$. The "Browse..."
button in a standard "Select Install Folder" does not execute any script
action (you can create your own Select Install Folder dialog to handle this)
or you can validate the before/after value of $_SB_INSTALLDIR$ to detect
changes.

The CANCEL button never executes any script action in SB7.

Hope this helps.

Friedrich

NewsArchive
10-11-2011, 12:32 AM
John,

There are additional tricks in the example files, some of which are
explained in "Learning SetupBuilder Part I"

For example,
in the latter file, look through the descriptions for
Custom Dialog 1 Demo - button,
Custom Dialog 1 Demo - Check Boxes for the on init event
Custom Dialog 2 Demo for the newselection event
Custom Dialog 3 Demo for the onupdate event

etc.

HTH

Jane

NewsArchive
10-11-2011, 03:46 AM
Thanks Jane - sounds interesting. Will check it out.

John