PHP Code:
new GuiWindowCtrl("objectname")
{
extent = {140, 62};
position = {50, 50};
text = "Window Title";
new GuiButtonCtrl("buttonname")
{
position = {6, 24};
extent = {128, 32};
text = "Button!";
}
}
... will create a window, and a button inside of it. Child objects usually go inside the parent objects.
The following code will show you how to handle the event of a button being clicked:
PHP Code:
function buttonname.onAction()
{
// code
}
If you would rather some custom actions, you could do:
PHP Code:
thiso.catchEvent(this, "onAction", "newActionName");
... inside one of the
new blocks, and then newActionName() would be called when the button is clicked, in the case of a button.
The first parameter passed to newActionName() would be the object of the button.
PHP Code:
function newActionName(obj)
{
// obj is the button that was clicked
}
You can also change parameters about an object later:
PHP Code:
with (controlname)
{
member = value;
}
PHP Code:
controlname.member = value;