Author Topic: I was just making a test GUI and trying some things out...  (Read 931 times)

I wanted to make a GUI for my server, so now I made a test GUI. (I kind of followed jes' tutorial)
And now it pops up an error when I execute it and it pulls the GUI up on the whole screen when I open it.  I did follow the whole tutorial.

The error that shows in the console when I execute it:

Error: cannot change namespace parent linkage for Testgui from GuiControl to GuiWindowCtrl.

*EDIT: And it also makes new testGUI's in the GUI Editor when I go through the GUINAME - NUMBER list.

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

   new GuiWindowCtrl(Testgui) {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "138 139";
      extent = "257 200";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      command = "canvas.popDialog(TestGUI);";
      accelerator = "escape";
      text = "Test";
      maxLength = "255";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "1";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      minSize = "50 50";
      closeCommand = "canvas.popDialog(TestGUI);";

      new GuiBitmapButtonCtrl() {
         profile = "BlockButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "52 112";
         extent = "140 30";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         command = "TestGUIButtonPush()";
         text = "Button";
         groupNum = "-1";
         buttonType = "PushButton";
         bitmap = "base/client/ui/button2";
         lockAspectRatio = "0";
         alignLeft = "0";
         alignTop = "0";
         overflowImage = "0";
         mKeepCached = "0";
         mColor = "255 255 255 255";
      };
   };
};
//--- OBJECT WRITE END ---

function Open_TestGUI(%toggle)
{
if(%toggle)
{
if(TestGui.isAwake())
{
canvas.popDialog(TestGui);
}

else
{
canvas.pushDialog(TestGui);
}
}
}
« Last Edit: October 08, 2012, 11:16:15 AM by tkepahama »

you used the same name for the guicontrol as you did for the window. use different names.

you used the same name for the guicontrol as you did for the window. use different names.
Ok, it works now.  Thanks.

*EDIT: I was messing with the button, and made a function for it when it's pushed (like in the tutorial), and it shows and error in the console when I click the button but I see no syntax errors in the function unless I'm doing something wrong which is a possibility since this is my first time making a GUI and stuff.

Code: [Select]
function TestGUIButtonPush(%client) //this is the function the button calls when pushed
{
announce("\c4"@%client.name@" \c3has pushed the button!");
}
« Last Edit: October 08, 2012, 11:24:01 AM by tkepahama »

the announce function won't work and will display an error unless you're the host.
and also, pressing the button doesn't pass any arguments to the function, aka %client is never set to a value.

the announce function won't work and will display an error unless you're the host.
and also, pressing the button doesn't pass any arguments to the function, aka %client is never set to a value.
I am the host.
And how do I make it show a message when the button is pushed such as, "[namehere] has pushed the button!"?

You need to have the button activate a server command, and that command would do the announcement.

so for example, in the client code
Code: [Select]
function TestGUIButtonPush()
{
commandToServer('announcemyname');
}

and in the server code:
Code: [Select]
function serverCmdAnnounceMyName(%Client)
{
announce("\c3" @ %Client.name SPC "\c6Has pressed the button!");
}

You need to have the button activate a server command, and that command would do the announcement.

so for example, in the client code
Code: [Select]
function TestGUIButtonPush()
{
commandToServer('announcemyname');
}

and in the server code:
Code: [Select]
function serverCmdAnnounceMyName(%Client)
{
announce("\c3" @ %Client.name SPC "\c6Has pressed the button!");
}
Oh I see, thanks.
*EDIT: Still shows a syntax error. :/
« Last Edit: October 08, 2012, 11:39:44 AM by tkepahama »

can I see the error message please?

can I see the error message please?
When I push the button it just says in console, Syntax error input.

oh, okay.
in the gui code, line 46, replace TestGUIButtonPush() with TestGUIButtonPush();