Game Development Community

Bitmap button help

by Erik Madison · in Torque Game Engine · 08/08/2004 (3:52 am) · 8 replies

I could use a hand from a button wiz...

I want to use a generic button for most of my needs, overlaying either text or another bitmap on top of it, as opposed to creating seperate button bitmaps with the text/graphic in the image.

Visually, this is working fine. However, the top layer is catching the mouse, not allowing the underlying button to be depressed unless you hit that small area the overlay isnt occupying.

What I wish to do, is have the overlay ignore the mouse completely, allowing the underlaying button to recieve any activity.

My example usage follows:
new GuiBitmapButtonCtrl() {
               profile = "LobbyGuiButtonProfile";
               horizSizing = "relative";
               vertSizing = "relative";
               position = "8 284";
               extent = "47 32";
               minExtent = "8 8";
               visible = "1";
               command = "ChooseModelDlg.PreviousModel();";
               text = "Button";
               groupNum = "-1";
               buttonType = "PushButton";
               bitmap = "~/data/ui/character/button0";
               Enable = "1";
           new GuiBitmapCtrl() {
               profile = "GuiDefaultProfile";
               horizSizing = "center";
               vertSizing = "center";
               position = "16 288";
               extent = "30 26";
               minExtent = "8 8";
               visible = "1";
               bitmap = "~/data/ui/character/Larrow";
               wrap = "0";
            };
            };

#1
08/08/2004 (4:45 am)
I believe its something like cankeyFocus or some such. I'd suggest looking at the guidefaultprofile to see all of the available fields. One might suggest a possible usage.

Or you could write your own button control to do what you want.
#2
08/08/2004 (8:09 am)
Hrm.
cankeyFocus doesn't seem to do anything. Perhaps its another of those great ideas that never was completed, or maybe I just missed something :)
Anyways, it appears that text support at least is already in the 3 incarnations of bitmap button controls (I use the latest, 4 state version), but it never seems to render the text. Gonna have to hunt this one...

Why is it the 'little' projects always seem to take more time than the full scale additions? Bleah.
#3
08/08/2004 (8:11 am)
How about clickthrough? search through the examples or source for it, I think it is added to the parent to allow "clicks" to be sent down to the child controls.

-Ron
#4
08/08/2004 (9:47 am)
I can't find any refs to clickthrough, any spelling.

However, the text aspect is working now. It seems there was a minor bug in the original bitmapbutton resource, and it followed through to all the updated versions.

The RenderJustifiedText() function is called during onRender(), but not in RenderButton(). Adding it there now allows any defined text profiles to be written on top of the bitmapped buttons.

An optional overlay bitmap addition to the main ctrl is probably better than adding a child ctrl as well.
#5
09/27/2004 (6:55 am)
@Erik could you elaborate on the text print over a bitmap on a button? I have been trying to get that to work for ages.
#6
09/27/2004 (7:40 am)
@howard Open the bitmapbutton file, look for OnRender. Somewhere in it is a call to RenderJustifiedText(). Copy that code into RenderButton(). I don't have code near me, or I'd be clearer.
#7
06/17/2006 (7:51 am)
Can you please be more clear on how to get the text to show up on a button? This is still a problem for me as well in 1.4.
#8
06/17/2006 (9:53 am)
You probably want to look at GuiBitmapButtonTextCtrl()