Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Bug Report (https://forums.graalonline.com/forums/forumdisplay.php?f=193)
-   -   Changing the parent of a GuiTextListCtrl causes it to lose all its rows (https://forums.graalonline.com/forums/showthread.php?t=134263959)

cbk1994 07-20-2011 04:48 AM

Changing the parent of a GuiTextListCtrl causes it to lose all its rows
 
When you add a GuiTextListCtrl inside a GuiScrollCtrl, then change the text list's parent using otherScroll.addParent, the text list no longer has any rows in it.

This is happening on the latest v6.

The following code can be used to replicate the problem:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  if (
Test_Window != null) {
    
Test_Window.destroy();
  }
  
  
// draw a window with two scrolls, one of which has a list in it
  
new GuiWindowCtrl("Test_Window") {
    
profile GuiBlueWindowProfile;
    
    
clientWidth 200;
    
clientHeight 200;
    
    
clientRelative true;
    
    new 
GuiScrollCtrl("Test_ScrollOld") {
      
profile GuiBlueScrollProfile;
      
      
width Test_Window.clientWidth;
      
height = (Test_Window.clientHeight 2) - 5;
      
      new 
GuiTextListCtrl("Test_List") {
        
profile GuiBlueTextListProfile;
        
        for (
temp.0temp.10temp.++) {
          
this.addRow(0"Row " temp.i);
        }
      }
    }
    
    new 
GuiScrollCtrl("Test_ScrollNew") {
      
profile GuiBlueScrollProfile;
      
      
width Test_Window.clientWidth;
      
height = (Test_Window.clientHeight 2);
      
      
Test_ScrollOld.height 5;
    }
  }
  
  
// now, move Test_List from Test_ScrollOld to Test_ScrollNew
  
echo("rows before: " Test_List.rows.size());
  
Test_ScrollNew.addControl(Test_List);
  echo(
"rows after: " Test_List.rows.size());


In F2, the output is:
Quote:

Originally Posted by F2
rows before: 10
rows after: 0

The expected output is:
Quote:

Originally Posted by F2
rows before: 10
rows after: 10


Tigairius 07-23-2011 08:46 PM

I'm really not sure what's causing this but I hope it gets fixed because it's really holding us back on some things for Ol' West. :S

Admins 07-23-2011 09:46 PM

Not sure why it did this, but it was clearing itself when being removed from the parent. It will be fixed in the next version.


All times are GMT +2. The time now is 07:16 AM.

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