Thread: parent delay?
View Single Post
  #1  
Old 01-31-2007, 11:43 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
parent delay?

Ive noticed a "delay" of some sort when parent.mod is being called upon "onCreated".

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  new 
GuiWindowCtrl("ChatWindow_Main") {
    
width = 200, height = 400;
    
x = screenwidth/2 - width/2, y = screenheight/2 - height/2;
    
    
//visible = false;
    
    
new GuiMLTextCtrl("ChatWindow_Text") {
      
width = parent.width - 14, height = parent.height - 30;
      
x = 8, y = 25;

      
setText("This is my text!");
    }
  }
} 
When I do that, the width and height of ChatWindow_Text is at default value. However, it works if I do this:

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  new 
GuiWindowCtrl("ChatWindow_Main") {
    
width = 200, height = 400;
    
x = screenwidth/2 - width/2, y = screenheight/2 - height/2;
    
    
//visible = false;
    
    
new GuiMLTextCtrl("ChatWindow_Text") {
      
width = ChatWindow_Main.width - 14, height = ChatWindow_Main.height - 30;
      
x = 8, y = 25;


      
setText("This is my text!");
    }
  }
} 

If I created the GUI first, and then try reading the parent values, they all match up to the proper value.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote