View Single Post
  #7  
Old 08-17-2007, 11:46 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
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 = {2020};
  }

  return 
true;
}

function 
onCreated()
{
  new 
GuiWindowCtrl(TestControl)
  {
    
position = {4040};
    
extent = {100100};

    
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 = {4040};
    
extent = {100100};

    
text "My Window";

    
this.drawingpanel = new GuiDrawingPanel();
  }

  
// Provide a direct object reference

  
this.drawAction(TestControl);

__________________
Skyld

Last edited by Skyld; 08-17-2007 at 11:57 PM..
Reply With Quote