Custom Tab Button in IGlass?

BlitzMax Forums/BlitzMax Programming/Custom Tab Button in IGlass?

Sean Doherty(Posted 2006) [#1]
Is there a way to implement a kind of custom tab button in IGlass? I want to use custom button but when one button is clicked the other buttons become unclicked.

Thanks


Sin of Nature(Posted 2006) [#2]
I dont really 100% understand what you are tying to do. Do you mean like radio buttons in other GUI's?

You can do it with checkbox's pretty easily (someones already done this in the IGlass forum links), but to use custom images is a whole different ball game. The IGL_CustomButton widget does not have a state property. When you click it, it flashes with the clicked images and then automatically reverts back to its original graphic.

My approach would be to:
1. Create an AnimatedButton with 2 frames (on/off).
2. Set the speed to 0 (so it doesnt animate)
3. To change the state(off/on or 0/1), set the current frame

If you had 3 buttons, everytime 2 of the buttons are set to frame 0, the other selected button is set to frame 1. To determine which of the 3 buttons is currently selected, simple use the property

MyAnimatedButton.FrameCurrent

Effectively, you'll be using like this:

If MyAnimatedButton1.ClickGadget() = true
MyAnimatedButton1.FrameCurrent = 1
MyAnimatedButton2.FrameCurrent = 0
MyAnimatedButton3.FrameCurrent = 0
Endif

If MyAnimatedButton2.ClickGadget() = true
MyAnimatedButton1.FrameCurrent = 0
MyAnimatedButton2.FrameCurrent = 1
MyAnimatedButton3.FrameCurrent = 0
Endif

If MyAnimatedButton3.ClickGadget() = true
MyAnimatedButton1.FrameCurrent = 0
MyAnimatedButton2.FrameCurrent = 0
MyAnimatedButton3.FrameCurrent = 1
Endif

There is actually a few ways you could do this. You could also use 2 static images per "button" and simply hiding the one not in use. With 3 buttons, you'd need 6 static buttons. 3 buttons are select, 3 are unselected. Only 1 selected static image would be visible at a time.

I can probably create a quick example if you need it. :-)

Sin