Game Development Community

popup inventory and mouse events

by Jared Hoberock · in Torque Game Engine · 03/15/2002 (8:27 am) · 8 replies

I'm trying to get the popup inventory tut to work. I've added gui mouse events to the guitextctrl and guibitmapctrl. THe mouse events worked when my parent gui control was guiBitmapCtrl, but when I changed it to guiTScontrol the text fields quit registering mouse clicks. Do I have to add mouse events to guiTScontrol as well or is there something else I'm doing wrong?

#1
03/15/2002 (11:04 am)
your parent should be GuiMouseEventCtrl so that it gets the mouse events from its parent. That might be your problem.

-Tim aka Spock
#2
03/15/2002 (6:32 pm)
Tim, do you think you could post yr code for inventorygui.gui? Or at least look at this one and tell me why the mouse clicks are not registering. Note that I have made guitextctrl, guibitmapctrl, and guitscontrol inherit from guimouseeventctrl.

new GameTSCtrl(InventoryGui) {
   profile = "GuiContentProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 8";
   visible = "1";
   helpTag = "0";

   new GuiBitmapCtrl(background) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "0 0";
      extent = "324 324";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
      lockMouse = "0";
      bitmap = "./invmap.png";
      wrap = "0";
   };
   new GuiTextCtrl(Slot1) {
      profile = "GuiTextProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "6 37";
      extent = "8 18";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
      lockMouse = "0";
      maxLength = "255";
   };
.
.
.
   new GuiObjectView(displayWindow) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "142 12";
      extent = "176 176";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
   };
etc.
#3
03/16/2002 (12:35 pm)
you did list the events correctly right?

example:

function Slot1::onMouseDown(%this, %obj) {

...

}


Also have you checked the console too see if its flagging any errors? Check all of the console since it could be some compile errors which would cause your changes not to work. btw, which tutorial are you using...there are 3 of them. Try putting some print statements in the oMouse functions to see if they are being called at all. echo("example print");

-Tim aka Spock
#4
03/19/2002 (11:32 am)
I'm using the version 3 tutorial, I think. I have tried putting echo statements in the onmouse functions. THey are not printing, meaning the muse clicks are not registering at all. The weird part is that the clicks were registering before I put the GameTScontrol in. There are no apparent console errors. I'd appreciate if you could compare my code to yours or post your code so I could determine what I'm doing wrong. I'm running out of ideas.
#5
03/19/2002 (12:25 pm)
Well the only "code" I have is in that tutorial. I guess if you can post the parts you changed Ill take a look at it and see if I see what is wrong.

-Tim aka Spock
#6
03/19/2002 (1:27 pm)
The code I posted above is the only stuff that is different from what you have in Inventory 3. My InventoryGui.cs file is identical to yours. Like I said, I had the mouse events working before I added the GameTSControl, so I think there is something going wrong in there. Do you have an InventoryGui.gui file that is fully functional? Could you post it, because it's not in the tutorial.
#7
03/19/2002 (6:26 pm)
Only thing I see wrong in the code above is I dont see the GameTSControl's ending }; ....it should be at the end of the gui controls as all of them should be inside it.

-Tim aka Spock
#8
03/19/2002 (7:08 pm)
Figured it out. I had a shapenamehud object over all the other stuff, blocking the mouse clicks. THanks for all your help.