Tips & Trix
How to make a Toggle Switch

Home
PUBz
Grafx Pax
Tips & Trix
Neo-Linx
Neo-Talk
NeoDezign Filez
Search NeoDezign
 
 
 

 


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... the Toggle Switch! . . . . . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . . . . . . . . . . . . . .

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...
    GotoLine "END" .(to skip the next routine)
    EndIf
     .
    If "[status]" "=" "Off"
    SetVar "[status]" "On"
    .Put your ON commands here...
    EndIf

    :END