I am not entirely sure I understand what you are trying to do, but in order to pass a GUI object to a function:
PHP Code:
//#CLIENTSIDE
function moveMyControl(temp.obj)
{
// Check if temp.obj is an object
// This will usually be your GuiControl object reference
if (temp.obj.type() != 2)
{
return false;
}
// Check if it has a child this.drawingpanel
if (temp.obj.drawingpanel == NULL)
{
return false;
}
// Perform your action in the scope of the control
with (temp.obj)
{
this.position = {20, 20};
}
return true;
}
function onCreated()
{
new GuiWindowCtrl(TestControl)
{
position = {40, 40};
extent = {100, 100};
text = "My Window";
}
// Provide a direct object reference
this.moveMyControl(TestControl);
// Alternatively use the (@ "") syntax to pass an object reference from a string name
this.moveMyControl((@ "TestControl"));
}
Now let's say each control has a child object, you can probably do something like this:
PHP Code:
//#CLIENTSIDE
function drawAction(temp.obj)
{
// Check if temp.obj is an object
// This will usually be your GuiControl object reference
if (temp.obj.type() != 2)
{
return false;
}
// Perform your action in the scope of the control
with (temp.obj.drawingpanel)
{
this.drawimagerectangle(...);
}
return true;
}
function onCreated()
{
new GuiWindowCtrl(TestControl)
{
position = {40, 40};
extent = {100, 100};
text = "My Window";
this.drawingpanel = new GuiDrawingPanel();
}
// Provide a direct object reference
this.drawAction(TestControl);
}