Game Development Community

Gui Bitmapbutton control not responding

by Stanley D Chatman · in Torque Game Builder · 08/29/2006 (6:37 am) · 4 replies

I have created a guibitmapbutton control but it is not responding to any events. I have the 4 button states as outlined in the various tutorials but when I move my mouse over the button nothing happens. Are there any additional steps I need to take to get this to respond.

#1
08/29/2006 (4:16 pm)
Check out this tutorial. It explains how to use the GuiBitmapButtonCtrl.
#2
08/29/2006 (4:16 pm)
Also, the consol should spam warnings for whatever state images it can't find when it loads the button. Check that with the (~) key.
#3
08/30/2006 (12:12 am)
Yep that is the tutorial I used as the basis for mine. The difference is that uses a modeless dialog for the and puts the button on top of that. I am trying to put my button directly in the mainscreenGui and was wondering if that made a difference. The issue with these tutorials is that they never state why. For instance why did they choose the modeless dialog gui in the first place.

I put my button directly on the default mainScreenGui and it does not worky..
#4
08/30/2006 (3:15 am)
It actually does say why it uses the modeless dialog profile: "so the clear parts won't hog mouse clicks."

In fact, at the very top it states that there are things used in the tutorial that arent fully explained and that you if you're new to the GUI system you should go over the earlier tutorial first. I realize it can be frustrating to learn unfamiliar things, but if the reasoning behind every technique used were fully explained in every tutorial it would be impossible to cover any sort of advanced topic. A lot of things are only briefly touched upon in the interest of keeping the tutorials as short and to the point as possible. I'm sorry if that caused you any headaches.

As for your problem, I would suggest creating a new GUI for your interface and pushing it to the canvas, but if you are set on adding the button to mainScreenGui, here is an example of a mainScreen.gui file with a guiBitmapButtonCtrl:

new GuiChunkedBitmapCtrl(mainScreenGui) {
   canSaveDynamicFields = "0";
   Profile = "GuiContentProfile";
   HorizSizing = "width";
   VertSizing = "height";
   position = "0 0";
   Extent = "640 480";
   MinExtent = "8 8";
   canSave = "1";
   Visible = "1";
   hovertime = "1000";
   bitmap = "MainMenuBitmapGui/data/images/logoblack";
   useVariable = "0";
   tile = "0";

   new t2dSceneWindow(sceneWindow2D) {
      canSaveDynamicFields = "0";
      Profile = "GuiContentProfile";
      HorizSizing = "width";
      VertSizing = "height";
      position = "0 0";
      Extent = "800 600";
      MinExtent = "8 8";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      lockMouse = "0";
      useWindowMouseEvents = "1";
      useObjectMouseEvents = "0";
   };

   new GuiBitmapButtonCtrl() {
      canSaveDynamicFields = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "12 48";
      Extent = "140 30";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      groupNum = "-1";
      buttonType = "PushButton";
      bitmap = "MainMenuBitmapGui/gui/menu/ExitButton";
   };
};


I just created and tested this gui with the exit button images from that tutorial.

I hope this was helpful.