Blockland Forums > Modification Help

GUI Help

Pages: (1/1)

jes00:

I made a GUI with a checkbox and it does not work and I don't know why. Could a good GUI maker please take a look at it?

Nexus:

Please have the foresight to explain your problem more than "it does not work"

How a checkbox control works:
Assign a variable to it.
I think it goes like this:
   variable = "$something";
$somthing will be true while the box is checked.
Add that variable to your code to do different things if $something is true or false.

jes00:

Ok here I go
1. the GUI will not open and idk why
2. Here is the code
--- Code: ---exec("./HiAndByegui.gui");
moveMap.bind(keyboard, "command h", pushHiAndByegui);

if($HiAndByeGUI::CheckboxToggle == 1)
I put what I want it to toggle here.

--- End code ---


Nexus:

oh god that code needs work
the exec part is good
then you need a function to open the gui, and a function to close it.
Please do this instead:

--- Quote ---$remapdivision[$remapcount] = "division";
$remapname[$remapcount] = "Toggle";
$remapcmd[$remapcount] = "openmygui"
$remapcount++;

function openmygui(%x)
{
   if(%x)
   {
      if(myguiname.isawake())
         canvas.popdialog(myguiname);
      else
         canvas.pushdialog(myguiname);
   }
}

function whatevertheguidoes()
{
   if($boxischecked)
   {
      //do something
   }
   else
   {
      //do something else
   }
}
--- End quote ---


jes00:


--- Quote from: Nexus on July 07, 2011, 03:43:48 PM ---oh god that code needs work
the exec part is good
then you need a function to open the gui, and a function to close it.
Please do this instead:

--- End quote ---
Thank you. I'm new to GUIs.
EDIT: There is no keybind setting in the options menu : /

Pages: (1/1)

Go to full version