Author Topic: Why does my GUI only open up while I'm in-game?  (Read 1409 times)

I haven't been able to get my GUI to load when pressing X on my keyboard in-game.  I copied and pasted everything from AGlass0fMilk's tutorial, modifying GUI elements for the GUI I want to make.

What went wrong?

MY TRACE LOG:
http://www.filedropper.com/showdownload.php/console_2

CLIENT.CS
Code: [Select]
exec("./BlocklandLive.gui");
moveMap.bind(keyboard, "x", pushTestgui);

function testcommand()
{
MessageBoxOK("Thanks!" @ "You have just pressed a button on a test GUI!");
}


BLOCKLANDLIVE.GUI
Code: [Select]
//--- OBJECT WRITE BEGIN ---
new GuiControl(BlocklandLive) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   enabled = "1";
   visible = "1";
   clipToParent = "1";
      themed = "1";

   new GuiWindowCtrl() {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "160 120";
      extent = "320 240";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      command = "canvas.popDialog(BlocklandLive);";
      accelerator = "escape";
      text = "BlocklandLive";
      maxLength = "255";
      resizeWidth = "0";
      resizeHeight = "0";
      canMove = "1";
      canClose = "1";
      canMinimize = "0";
      canMaximize = "0";
      minSize = "50 50";

      new GuiTextCtrl(LiveText) {
         profile = "GuiMediumTextProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "33 80";
         extent = "253 28";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         text = "Hello, %name.";
         maxLength = "255";
            themed = "1";
      };
      new GuiBitmapButtonCtrl() {
         profile = "BlockButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "121 125";
         extent = "78 34";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         command = "testcommand();";
         accelerator = "enter";
         text = "Addons";
         groupNum = "-1";
         buttonType = "PushButton";
         bitmap = "base/client/ui/button2";
         lockAspectRatio = "1";
         alignLeft = "0";
         alignTop = "0";
         overflowImage = "0";
         mKeepCached = "0";
         mColor = "255 255 255 255";
            themed = "1";
      };
   };
};
//--- OBJECT WRITE END ---

function pushTestgui(%Gui)
{
   %Gui = canvas.pushDialog(BlocklandLive);
}

LiveText.setText("Hello," @ $Pref::Player::NetName @ ".");

« Last Edit: May 31, 2017, 12:22:06 AM by theviacom »

I would like to mention that when I use the function for opening up GUI from Jes00's tutorial, the GUI only works in-game. 

So it turns out that the issue was capitalization.  Everything's good now.

So here's a different question: Why does my GUI only open up while I'm in-game?

I told you yesterday about this. It's because you need to bind it to the global map.

Code: [Select]
GlobalActionMap.bind(keyboard, "x", pushTestgui);
Keep in mind that you need to make sure that you don't override someone else global bind.

Also, please don't change the topic title due to a new question. Instead, create a new thread and lock the old one.

Instead, create a new thread and lock the old one.

No. You shouldn't ever lock a thread here.

I told you yesterday about this. It's because you need to bind it to the global map.

Code: [Select]
GlobalActionMap.bind(keyboard, "x", pushTestgui);
Keep in mind that you need to make sure that you don't override someone else global bind.

Also, please don't change the topic title due to a new question. Instead, create a new thread and lock the old one.

That's the fault of my misunderstanding.  Thank you for the reminder.

No. You shouldn't ever lock a thread here.

Based Zeblote.

Also, please don't change the topic title due to a new question. Instead, create a new thread and lock the old one.
Please do not confuse him, I told him the other day to never lock any mod help topics (unless it was a mistake posting)

People may have something important to say but cannot say anything if the topic is locked.

No. You shouldn't ever lock a thread here.
Please do not confuse him, I told him the other day to never lock any mod help topics (unless it was a mistake posting)

People may have something important to say but cannot say anything if the topic is locked.

Sure, I was unaware of the unlisted rules, and will adjust me accordingly.

But changing the topic name for a new question is still a bad thing, right?