Source language: Translate to:

Toggle Switch

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Toggle Switch

Postby Jim Brammer » Thu Feb 07, 2002 3:28 pm

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...
   SetVar "[status]" "On"
  .Put your ON commands here...
Jim Brammer

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 0 guests