View Single Post
  #1  
Old 07-20-2011, 04:48 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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
__________________
Reply With Quote