Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #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 200height 400;
    
screenwidth/width/2screenheight/height/2;
    
    
//visible = false;
    
    
new GuiMLTextCtrl("ChatWindow_Text") {
      
width parent.width 14height parent.height 30;
      
825;

      
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 200height 400;
    
screenwidth/width/2screenheight/height/2;
    
    
//visible = false;
    
    
new GuiMLTextCtrl("ChatWindow_Text") {
      
width ChatWindow_Main.width 14height ChatWindow_Main.height 30;
      
825;


      
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
  #2  
Old 01-31-2007, 12:30 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Oh yea, I had this exactly same problem and it gave me such a headache >_>. Until I figured out that parent was set after the thing finished.
I suppose you could create all the GUI Controls first then edit them using with (ControlName) {}
__________________
Reply With Quote
  #3  
Old 01-31-2007, 12:55 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
The new GuiControl() {} thing is a combination of new, with (control) { } and addcontrol(control), so the parent is not set before it is actually added at the end of the command.
Reply With Quote
  #4  
Old 01-31-2007, 09:26 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I was going to say that...

Using new does not define the parent until after the new is finished. It is better to do the addcontrol() inside the new before you call the parent or to just use onResize() functions for defining child positions (You could make a chain reaction from the GUIControl all the way down to the position of a radio button or something and then call the function at the end of your GUI Creation script so everything get positioned)
__________________
Do it with a DON!
Reply With Quote
  #5  
Old 02-01-2007, 06:37 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
Quote:
Originally Posted by zokemon View Post
I was going to say that...

Using new does not define the parent until after the new is finished. It is better to do the addcontrol() inside the new before you call the parent or to just use onResize() functions for defining child positions (You could make a chain reaction from the GUIControl all the way down to the position of a radio button or something and then call the function at the end of your GUI Creation script so everything get positioned)
Seeing as though Ive never done that, care to give an example?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:17 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.