Using toggle buttons

xlobby docs (works in progress)

Using toggle buttons

Postby stevenhanna6 on Tue Apr 04, 2006 2:13 am

By default each button has one toggle state. Usually this would be enough to accomplish most tasks, the use of a multi toggle state button should be reserved unless needed as they are more complex to understand.

Basicly a multi state toggle button will have multile toggle states, these states are added and removed through the "Event" tab for a button. Remember each button will have a "default" state to start with.

When you add a new toggle state, it will be called "new" this would be a good time to rename your toggle state to something that makes more sense, like "on" or "light on". When a toggle state is selected from the "Event" tab or the "Image" tab the button on the screen will switch to this state. But you will only notice a visual change if your toggle state have different button images.

Lets describe what a toggle state is now, its a state that can be assigned an image and click/enter/exit events. These toggle states are independent on each other, meaning a click event on toggle state "default" for example will NOT be on any other toggle state unless you set it up that way. First lets talk about images/

Yes toggle states have their own images, you can change the image of a toggle state my first selecting the toggle state you wish to change from "Event" or "Images" section boxes. Once a toggle state is selected you will have be able to change the image from the "Image" tabs. To check if your toggle states have different images try switching betwen 2 different states you should see a difference if they have been assigned different images.

But how do I change the toggle state of a buton?

First thing you should do is assign your toggle buttons a "button id" under the "Default" tab. It will be impossible for xlobby to change a button toggle state without knowing which button you want to change. Next thing you need is to use a command there are 3 special commands they are

"button state set" which requires a buttonID and a state
"button state prev" which requires a buttonID
"button state next" which requires a buttonID

NOTICE they all need a buttonID!! I told you to give your toggle button a button ID!!! I wont say it again!!

Now as you might not or might have guessed we create events with these commands to change the state of a button or buttons. Like I mentioned earlier a toggle state has is very own click/enter/exit events that you must assign. Let me run through a quick example.

Lets say we have 4 buttons on a screen, we have also created a new toggle state for each button called "on" and left the "default" state unchanged. We then went into the "image" tab for each button and made sure that the "on" state had its own image. We also give all four buttons the exact same id "myid" just to make things simple, but they could each have there own ids of course. Ok now lets change the state of our buttons, we create 2 new events the first will be called "set to default" and will use the "button state set" with the button id "myid" with the state set to "default" and we create another event called "set to on" with the button id "myid" and the state "on"....ok now we assign this too one of our buttons. We have to be careful here, select a button, make sure its in the "default" state and set the "click" event to "set to on" then change the state to "on" and set the "click event to "set to default". Now when you trigger that event it will change the state for all the buttonids that match and have that specific state.

Thats about all there is to toggle buttons. lol damn thats alot of typing :)
stevenhanna6
 
Posts: 904
Joined: Tue Feb 18, 2003 10:39 am
Location: Ontario, Canada

Postby sharp_1 on Tue Sep 19, 2006 3:01 pm

Rika did a great job of illustrating toggle button creation here: http://www.xlobby.com/forum/viewtopic.php?p=32891#32891
Thanks Rika!!!
sharp_1
 
Posts: 630
Joined: Tue Jan 31, 2006 1:01 am
Location: Wisconsin