Bitmapped buttons not working
by __._ · in Torque Game Engine · 11/09/2006 (2:15 am) · 4 replies
Hi all,
I am trying to add GuiBitmapButtonCtrl buttons to my GUI, but so far its not working. The button shows up, but it wont display any image. When I copy an existing button from the tutorial.base mainmenu the new button shows up properly, but when I replace the bitmap with another image (from the tutorial.base files) the same problem occurs. I have included the gui code from both an original button and a new one. You'll see that only the coordinates differ, yet the first button (which already existed) works and the second one (made by me) shows the text and no bitmap.
What am I doing wrong? Thanks in advance.
I am trying to add GuiBitmapButtonCtrl buttons to my GUI, but so far its not working. The button shows up, but it wont display any image. When I copy an existing button from the tutorial.base mainmenu the new button shows up properly, but when I replace the bitmap with another image (from the tutorial.base files) the same problem occurs. I have included the gui code from both an original button and a new one. You'll see that only the coordinates differ, yet the first button (which already existed) works and the second one (made by me) shows the text and no bitmap.
new GuiBitmapButtonCtrl() {
Profile = "GuiBorderButtonProfile";
HorizSizing = "right";
VertSizing = "top";
position = "143 7";
Extent = "41 43";
MinExtent = "8 2";
Visible = "1";
Command = "ToggleConsole(1);";
tooltipprofile = "GuiToolTipProfile";
tooltip = "View the scripting Console, which allows you to enter TorqueScript commands on the fly";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "./buttons/console";
};
new GuiBitmapButtonCtrl() {
Profile = "GuiBorderButtonProfile";
HorizSizing = "right";
VertSizing = "top";
position = "262 15";
Extent = "41 43";
MinExtent = "8 2";
Visible = "1";
Command = "ToggleConsole(1);";
tooltipprofile = "GuiToolTipProfile";
tooltip = "View the scripting Console, which allows you to enter TorqueScript commands on the fly";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "./buttons/help_n";
};What am I doing wrong? Thanks in advance.
#2
p.s. what does the i stand for? I get the normal, hover and down, but i stands for ?
11/09/2006 (3:53 am)
Thank you. It worked right away now. Can anyone tell me, was this changed in version 1.5? I am not yet sure we are going to use the new version for our gaming course.p.s. what does the i stand for? I get the normal, hover and down, but i stands for ?
#3
I haven't tested bitmap buttons in TGE 1.5, but it probably works the same way.
11/09/2006 (4:03 am)
I=Inactive/DisabledI haven't tested bitmap buttons in TGE 1.5, but it probably works the same way.
#4
04/20/2009 (11:32 am)
Gracias por la explicación, para mi también fue de ayuda.
Torque Owner Aaron E
Default Studio Name
Here is a slightly edited version of an answer I gave on another thread. Some might accuse me of plagerizing myself, but I'm all about saving the environment and recycling stuff. :)
=====================================
The guiBitmapButtonCtrl can be tricky at times. It doesn't really work the way you might expect it to in the GUI editor.
Generally, Torque expects to find three or four image files for each bitmap button (filename_n, filename_h, filename_d, and filename_i). Using this arrangement for an exit button (as an example), you would probably need exit_n.png, exit_h.png, exit_d.png, and exit_i.
The _n version of the image is what it should look like in the normal position. _h is what the image should look like when it is highlighted or when the mouse pointer is hovering over it. _d is what should be seen when the user clicks down on the button. And _i signifies a button's look when it is inactive or disabled. The thing is, once you've created those file variations, you don't have to reference the _X name stuff, only the root name of the image.
So in the Torque GUI editor, when you create your bitmap button, you should reference the group of image files rather than a specific file. Using the example above, we would set the path for the bitmap image to starter.fps\client\ui\buttons\exit instead of exit_n.png. Of course your file paths might be different from time to time. :) But generally, you only need the base name of the image group, that's it.
=========================================
So, after all that, the short answer to your question is . . . delete _n from "./buttons/help_n" so that you only see ".buttons/help". That's it.
Have fun.