Author Topic: How do I make the message Box pop up?  (Read 551 times)

How do I?
Whi won't it with this code?
And, how does it work?

[so far I get the gui up and I can click the button, but it does nothing when I do]





Code for GUIZ.cs :

Code: [Select]
exec("./Join.gui");
moveMap.bind(keyboard, "m", pushtestgui);

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




Code for Join.gui :

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

   new GuiWindowCtrl() {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "112 184";
      extent = "96 98";
      minExtent = "8 2";
      visible = "1";
      maxLength = "255";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "1";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      minSize = "50 50";

      new GuiBitmapButtonCtrl() {
         profile = "GuiDefaultProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "17 46";
         extent = "60 28";
         minExtent = "8 2";
         visible = "1";
         text = "    Join us!";
         groupNum = "-1";
         buttonType = "PushButton";
         bitmap = "base/client/ui/button1";
         lockAspectRatio = "0";
         alignLeft = "0";
         overflowImage = "0";
         mKeepCached = "0";
         mColor = "255 255 255 255";
      };
   };
};
//--- OBJECT WRITE END ---
function pushtestgui(%Gui)
{
   %Gui = canvas.pushDialog(Joincit);
}

in pushtestgui(%gui), you do not need the argument (%gui), nor do you need "%gui = ".  Just canvas.pushDiaolog(joinCit); would suffice.

Code: [Select]
function pushTestGui()
{
      canvas.pushDialog(joinCit);
}

But either way it would work.

Also, to make the button use the command when you click it, put a command field in the Bitmap Button Control thing so its like this:
Code: [Select]
//--- OBJECT WRITE BEGIN ---
new GuiControl(Joincit) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   visible = "1";

   new GuiWindowCtrl() {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "112 184";
      extent = "96 98";
      minExtent = "8 2";
      visible = "1";
      maxLength = "255";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "1";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      minSize = "50 50";

      new GuiBitmapButtonCtrl() {
         profile = "GuiDefaultProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "17 46";
         extent = "60 28";
         minExtent = "8 2";
         visible = "1";
         command = "testCommand();"; <------------------------------------------------------------
         text = "    Join us!";
         groupNum = "-1";
         buttonType = "PushButton";
         bitmap = "base/client/ui/button1";
         lockAspectRatio = "0";
         alignLeft = "0";
         overflowImage = "0";
         mKeepCached = "0";
         mColor = "255 255 255 255";
      };
   };
};
//--- OBJECT WRITE END ---
function pushtestgui(%Gui)
{
   %Gui = canvas.pushDialog(Joincit);
}

It should be like this:

command = "testCommand();";
« Last Edit: June 26, 2009, 10:01:37 PM by AGlass0fMilk »