Game Development Community

About some question on GUI

by Apppothk · in iTorque 2D · 11/16/2010 (9:17 am) · 1 replies

scoreBoardGui.gui
%guiContent = new GuiControl(scoreBoardGui) {
   canSaveDynamicFields = "0";
   isContainer = "1";
   Profile = "GuiDefaultProfile";
   HorizSizing = "width";
   VertSizing = "height";
   Position = "0 0";
   Extent = "320 480";
   MinExtent = "8 2";
   canSave = "1";
   Visible = "1";
   tooltipprofile = "GuiDefaultProfile";
   hovertime = "1000";

   new GuiControl() {
      canSaveDynamicFields = "0";
      isContainer = "1";
      Profile = "GuiDefaultProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      Position = "9 376";
      Extent = "304 92";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";

      new GuiTextCtrl() {
         canSaveDynamicFields = "0";
         isContainer = "0";
         Profile = "GuiDefaultProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         Position = "120 -17";
         Extent = "185 77";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         text = "Score:";
         maxLength = "1024";
      };
      new GuiTextCtrl(ScoreboardGuiScore) {
         canSaveDynamicFields = "0";
         isContainer = "0";
         Profile = "GuiDefaultProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         Position = "197 -16";
         Extent = "185 77";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         text = "999";
         maxLength = "1024";
      };
      new GuiTextCtrl(ScoreboardGuiTargetScore) {
         canSaveDynamicFields = "0";
         isContainer = "0";
         Profile = "GuiDefaultProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         Position = "198 7";
         Extent = "124 77";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         text = "9999999";
         maxLength = "1024";
      };
      new GuiTextCtrl() {
         canSaveDynamicFields = "0";
         isContainer = "0";
         Profile = "GuiDefaultProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         Position = "113 9";
         Extent = "77 73";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         text = "Target:";
         maxLength = "1024";
      };
      new GuiBitmapButtonCtrl() {
         canSaveDynamicFields = "0";
         isContainer = "0";
         Profile = "GuiDefaultProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         Position = "13 54";
         Extent = "106 30";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         groupNum = "-1";
         buttonType = "PushButton";
         useMouseEvents = "0";
         bitmap = "default.png";
      };
   };
};



mainScreenGui.gui
%guiContent = new GuiControl(mainScreenGui) {
   canSaveDynamicFields = "0";
   isContainer = "1";
   Profile = "GuiDefaultProfile";
   HorizSizing = "width";
   VertSizing = "height";
   Position = "0 0";
   Extent = "480 320";
   MinExtent = "480 320";
   canSave = "1";
   Visible = "1";
   hovertime = "1000";

   new t2dSceneWindow(sceneWindow2D) {
      canSaveDynamicFields = "0";
      isContainer = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "width";
      VertSizing = "height";
      Position = "0 0";
      Extent = "480 320";
      MinExtent = "480 320";
      canSave = "1";
      Visible = "1";
      tooltipprofile = "GuiDefaultProfile";
      hovertime = "1000";
      lockMouse = "0";
      useWindowMouseEvents = "1";
      useObjectMouseEvents = "1";
   };

};



Canvas.popDialog(gameMode);
 Canvas.setContent(mainScreenGui);
 sceneWindow2D.schedule(200,"loadLevel","game/data/levels/emptyLevel.t2d"); 
 Canvas.pushDialog(scoreBoardGui);

i have mainScreenGui and add scoreBoardGui on the mainScreenGui.
now i can't click mainScreenGui's content.
how to solve this problem?

#1
11/22/2010 (12:09 am)
I am guessing that your problem is related to you using "GuiDefaultProfile" as the Profile for your GUI objects. If you search in your files for the object "GuiDefaultProfile", you will see that it has this value:
modal = true;
In Torque, when it sees that a GuiControl has that value set to true, then it assumed that object wants to respond to touch/mouse input, so your new objects are probably covering the mainScreen Gui stuff, not allowing it to respond to input.

So, you should create a new GuiControlProfile and set 'modal = false'. It should be adequate enough to just copy the entire definition of "GuiDefaultProfile", rename it, set modal = false, and then have your Gui objects use that instead.

I just recently had this problem, so it's fresh in my head :-) I hope this helps you.