Turn on/off GUI lights based on selections?
by Flybynight Studios · in Torque Game Engine · 08/22/2006 (9:27 am) · 7 replies
Trying to get my head around this. Seems like a simple concept I think I am just not sure how to search for the proper words yet.
Take a list of 5 selections a player can make and have a "light" to the left of the selections. I want to activate the light for the item selected. Only one light can be active at a time.
O = light
O selection1
O selection2
O selection3
etc etc
When a player clicks on the selection (which is a gui button) it activates the function to poll for information for that selection. I would like the light to also come on for that selection and deactivate any lights from the previous selection.
By default when the GUI screen opens the first time the first selection is forced active and the results of the first item are polled. What I am looking for is a suggestion on the best way to handle the lighting up of the "light" to the left of the button.
Could I use some kind of guichunkedBMPctrl? and then set visible or not visible from a function?
Any input would be greatly appreciated.
Thanks
EDIT for clarity: I am using mouse overs to highlight the button that is pressed etc and I am not looking to keep the selection highlighted, I just want the "last clicked" selection to be noted by the light to the left. Then when a player makes a different selection, turn off teh current light and turn on the newly selected light.
Take a list of 5 selections a player can make and have a "light" to the left of the selections. I want to activate the light for the item selected. Only one light can be active at a time.
O = light
O selection1
O selection2
O selection3
etc etc
When a player clicks on the selection (which is a gui button) it activates the function to poll for information for that selection. I would like the light to also come on for that selection and deactivate any lights from the previous selection.
By default when the GUI screen opens the first time the first selection is forced active and the results of the first item are polled. What I am looking for is a suggestion on the best way to handle the lighting up of the "light" to the left of the button.
Could I use some kind of guichunkedBMPctrl? and then set visible or not visible from a function?
Any input would be greatly appreciated.
Thanks
EDIT for clarity: I am using mouse overs to highlight the button that is pressed etc and I am not looking to keep the selection highlighted, I just want the "last clicked" selection to be noted by the light to the left. Then when a player makes a different selection, turn off teh current light and turn on the newly selected light.
#2
Seems to me I could use a simple GUIbitmapctrl with a visible on off thing. Right now where Im at is I left the unlit light image as part of the splash screen for the gui so akk I really need to do is overlay the lighting img file when a selection is made.
Thanks for any help
08/22/2006 (12:51 pm)
I am not sure what gui control to use but basically I have a simple image file that is the light unlit and anothe rimage file that is the light lit. I want the light to stay lit after a selection is made to indicate that selection indefinitely or untill the gui is closed or a new selection is made.Seems to me I could use a simple GUIbitmapctrl with a visible on off thing. Right now where Im at is I left the unlit light image as part of the splash screen for the gui so akk I really need to do is overlay the lighting img file when a selection is made.
Thanks for any help
#3
08/22/2006 (1:00 pm)
I think James is right. What you want is a simple radio button. You just need to put your graphics in one file (actually, you'd have to put it in 4 times, twice unlit and twice lit) with a red line separating your graphics. Copy the radio button datablock and change the image to the one with your graphic. Then you just need to add a radio button to your GUI and specify the new datablock that you just created.
#4
Here is the GUI all lit up.

The player name area is the button part. I dont want people clicking on the light bulb I want them clicking on the player name. I just want the logo to light up next to the currently selected name.
The screenshot BTW is not the working GUI jsut the image file with all the mouse overs lit up =) I am not a complete idiot I do know how to create GUIs but I am trying to figure out the "best" way to code in the little logos lit up. I think I need to setup 4 different GUIbitmapctrl s, 1 for each slot and then turn them visible or invisible depending on which character is selected.
Still looking for input on this.
Thanks
08/22/2006 (1:20 pm)
Hmm.. I dont think radio buttons are what I want.Here is the GUI all lit up.

The player name area is the button part. I dont want people clicking on the light bulb I want them clicking on the player name. I just want the logo to light up next to the currently selected name.
The screenshot BTW is not the working GUI jsut the image file with all the mouse overs lit up =) I am not a complete idiot I do know how to create GUIs but I am trying to figure out the "best" way to code in the little logos lit up. I think I need to setup 4 different GUIbitmapctrl s, 1 for each slot and then turn them visible or invisible depending on which character is selected.
Still looking for input on this.
Thanks
#5
).
Also, if you don't want people clicking on the lights, you should make the "Create" areas light up as the moues rolls over them.
If this isn't quite what you had in mind, just let me know. Sometimes it takes a few interations before the whole problem is understood.
Edit: That should be Light<0|1|2|3>.setBitmap(). When you create the 4 GuiBitmapCtrls, make sure you name them something like Light0, Light1, etc. That way you can re-access them in the button's callback.
08/22/2006 (3:44 pm)
Go ahead and create 4 GuiBitmapCtrls for the "lights". Make sure that the bitmap set is the "off" bitmap. Then make the "Create" areas buttons. In the button callback, you find out which button was pressed (either by setting custom data on each button or by naming each button something different). You then reset the all of the "lights" and turn on the single "light" you need. The best way I've found to do this is by calling something like setBitmap(Also, if you don't want people clicking on the lights, you should make the "Create" areas light up as the moues rolls over them.
If this isn't quite what you had in mind, just let me know. Sometimes it takes a few interations before the whole problem is understood.
Edit: That should be Light<0|1|2|3>.setBitmap(
#6
Thanks William. I think thats exactly what I need. The mouseover for the create stuff is fine and everytime a slot is selected it triggers a couple functions, one of which is the update function for the player info to be displayed in the empty right hand part of the screen. I can make the bitmap updates in there.
Now please dont laugh ;) but how do I name the ctrls? in the variable area?
IE:
new guibitmapctrl(light0){
...
...
};
?
Thanks a mill for your advice.
08/22/2006 (4:14 pm)
By golly I think that made sense to me =)Thanks William. I think thats exactly what I need. The mouseover for the create stuff is fine and everytime a slot is selected it triggers a couple functions, one of which is the update function for the player info to be displayed in the empty right hand part of the screen. I can make the bitmap updates in there.
Now please dont laugh ;) but how do I name the ctrls? in the variable area?
IE:
new guibitmapctrl(light0){
...
...
};
?
Thanks a mill for your advice.
#7
08/29/2006 (9:33 pm)
Sorry for the late reply... just got back. What you have in your example is exactly correct. If you use the GUI editor, it is the field next to the "Apply" button (if I remember correctly).
Torque 3D Owner James Spellman