Game Development Community

Captioned bitmap buttons

by Drew -Gaiiden- Sikora · in Torque Game Builder · 12/01/2005 (2:10 am) · 6 replies

I've been trying to place text controls atop of blank bitmap buttons to caption them but I guess the text controls suck in the mouse events since they are layered on top and the button only registers being hovered over outside the area of the text control. Is there a way to keep this from happening?

Another idea is that these buttons are very simple rectangular buttons with black insides and a green border a few pixels thick. Could I just skin a normal button to look like that so that I could use the text field of the button?

members.gamedev.net/gaiiden/images/screens/gc/gc%20editor%20small.jpg
You can see the rectangular buttons on the shot above

#1
12/01/2005 (3:49 am)
Why not use GuiBitmapButton instead of GuiButton?
#2
12/01/2005 (10:33 am)
Assuming you're trying to avoid making a bunch of specific GuiBitmapButtons, take a look here for tips on using text labels over buttons.
#3
12/01/2005 (11:08 am)
I can't see this thread... :(
#4
12/01/2005 (11:17 am)
It's in TGE-land, sorry about that. Here's the relevent bits:


Matthew Langley says:
Quote:
Just create a guiBitmapButtonCtrl then right click it (so the next control will be a child of it) and create a guiTextCtrl as a Child of the control, so the text is within the button.

C2 follows with:
Quote:
@ Matt Langley: Yeah, that works (Thanks for teaching me something new about right clicking on Gui objects, never looked into that), however the text is not part of the button, so when you mouse over the text that is on top of the button, you cannot click the button. The text seems to block the activity of the GuiBitmapButtonCtrl.

Edit: If you use a GuiMLTextNoSelectProfile, it works. It's obvious, TextNoSelect, makes the text not be able to be selected, thus when you mouse over, it selects the button as usual.


So just make the text label a child of the button, and make sure the textControl's profile is using "modal = false" which makes the text unselectable/unfocusable so you can click the actual button parent.

Alternatively, according to Jacob:
Quote:
Howard, there is a GuiBitmapButtonTextCtrl but it was not implemented as a CONOBJECT (IMPLEMENT_CONOBJECT)...so, in guiCanvas.cc somewhere with the other IMPLEMENT_CONOBJECT statements add:

IMPLEMENT_CONOBJECT(GuiBitmapButtonTextCtrl);
and you will have it available in the editor. This will do just what you want. Have fun :)

So if you're comfortable re-compiling (and that information is still up to date) you could get a Bitmap button that exposes its text label appropriately, obviating the need for the textCtrl-over-bitmapButtonCtrl.
#5
12/01/2005 (1:24 pm)
Thank you @Luke :)
#6
12/01/2005 (6:57 pm)
Crap I had forgotten what right-clicking does, haha :) Awesome thx for the info Luke