Page 1 of 1

Toggle Switch

PostPosted: Thu Feb 07, 2002 3:28 pm
by Jim Brammer
You can use one button to perform two separate sets of actions. Click it once, it executes one set of action commands. Click it again, it does something else. Toggle On, Toggle Off.

Usually a button has a long string of commands and that's all that button can do. You either need to go to another page with a different button or have more buttons on the page. Sometimes a Toggle button could be used in place of two or more buttons on a page resulting in a cleaner, less cluttered interface.

First initialize the on/off variable in the Page Actions:
SetVar "[status]" "Off"


Then make your button.  Start your button action with If statements.

If "[status]" "=" "On"
   SetVar "[status]" "Off"
  .Put your OFF commands here...
Else
   SetVar "[status]" "On"
  .Put your ON commands here...
EndIf