Game Development Community

GuiBitmapButtonCtrl onMouseDown is not working

by Katrina Rose · in Torque Game Engine · 08/17/2004 (6:36 am) · 3 replies

new GuiBitmapButtonCtrl(Hellfire1Button1) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "338 122";
      extent = "27 36";
      minExtent = "8 2";
      visible = "1";
      text = "Button";
      groupNum = "-1";
      buttonType = "PushButton";
      bitmap = "./MultiMdc";
   };
   new GuiBitmapCtrl(mGraphic) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "366 118";
      extent = "100 44";
      minExtent = "8 2";
      visible = "0";
      wrap = "0";
   };
   new GuiBitmapButtonCtrl(hellfire1Button2) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "316 199";
      extent = "140 30";
      minExtent = "8 2";
      visible = "1";
      text = "Button";
      groupNum = "-1";
      buttonType = "PushButton";
   };

I created a new Gui Control and added 2 GuiBitmapButtonCtrl buttons, and then created a CS file (EXEC'd them in, and everything works but the onMouseDown events.

function Hellfire1Button1::onMouseDown(%this, %obj)
{
  echo("Button 1 MouseDown------------------");
}
function hellfire1Button2::onMouseDown(%this, %obj)
{
  echo("Button 2 MouseDown-------------------");
}
When I click on either button nothing happens. In the console I do not get the echo's.

I am pulling my hair out.

Thanks for your help

Marrion Cox

#1
08/17/2004 (7:52 am)
You need to set the command = to your function you want to call.
#2
08/17/2004 (8:26 am)
Thanks for your help. I got it working, but I still don't understand why there is an onMouseDown Event when it does not do anything. I guess the callback is broken. Thanks again

Marrion Cox
#3
08/17/2004 (8:42 am)
I don't think it's broken, I think those controls just are not based on the guiMouseEventCtrl control.

Look at the inheritance diagram.

The guiBitmapButtonCtrl derives from the GuiButtonCtrl.

There is a resource that tells you house to add mouse events to a control.