www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - problem with TableTree

When I build, this program it correctly generates a tree however if I open an 
item that is not the last item in the tree everything else seems to become a 
copy of the item I just opened (just try it it's fairly apparent). more or less 
the same code works when I use just a regular Tree.

Any thoughts??


-----------------
import std.stream;
import std.stdio;

import dwt.all;
version(build){
	debug{
		pragma(link, "dwtd.lib");
	}else{
		pragma(link, "dwt.lib");
	}

	pragma(link, "test.res");

	pragma(link, "advapi32.lib");
	pragma(link, "comctl32.lib");
	pragma(link, "gdi32.lib");
	pragma(link, "shell32.lib");
	pragma(link, "comdlg32.lib");
	pragma(link, "ole32.lib");
	pragma(link, "uuid.lib");
	pragma(link, "phobos.lib");
	
	pragma(link, "user32_dwt.lib");
	pragma(link, "imm32_dwt.lib");
	pragma(link, "shell32_dwt.lib");
	pragma(link, "msimg32_dwt.lib");
	pragma(link, "gdi32_dwt.lib");
	pragma(link, "kernel32_dwt.lib");
	pragma(link, "usp10_dwt.lib");
	pragma(link, "olepro32_dwt.lib");
	pragma(link, "oleaut32_dwt.lib");
	pragma(link, "oleacc_dwt.lib");	
}



class Hello
{	
   private Shell shell;
   private TableTree tree;
	
   public Shell open(Display display)
   {
			// set up shell
     shell = new Shell(display);
     shell.setLayout(new GridLayout());
     shell.setText("bug");

     tree = new TableTree(shell, DWT.SINGLE);

     Table table = tree.getTable();

     with(new TableColumn (table,DWT.NONE))
     {
       setWidth(100);
       setText("name");
     }

     TableTreeItem t1, t2,t3;
     tree.removeAll();

     t1 = new TableTreeItem(tree,0); t1.setText(0,"hello");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"you");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"me");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"we");
     t1 = new TableTreeItem(tree,0); t1.setText(0,"good");
     t1 = new TableTreeItem(tree,0); t1.setText(0,"looking");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"you");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"me");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"we");
     t1 = new TableTreeItem(tree,0); t1.setText(0,"goodby");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"y'all");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"pronoun");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"2nd person");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"plural");
     t1 = new TableTreeItem(tree,0); t1.setText(0,"narcissist");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"me myself and I");
      t2 = new TableTreeItem(t1,0); t2.setText(0,"Pirate");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"Yoh Ho Ho");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"and");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"a");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"bottle");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"of");
       t3 = new TableTreeItem(t2,0); t3.setText(0,"rum");


     tree.setLayoutData(
       new GridData(
         GridData.GRAB_HORIZONTAL |
         GridData.GRAB_VERTICAL |
         GridData.HORIZONTAL_ALIGN_FILL |
         GridData.VERTICAL_ALIGN_FILL
         )
       );

     table.setHeaderVisible(1);

     shell.open();


     return shell;
   }

   public static void run()
   {
     Display display = Display.getDefault();

     Hello hello = new Hello();
     Shell shell = hello.open(display);

     while (!shell.isDisposed())
     {
       if (!display.readAndDispatch())
         display.sleep();
     }
     display.dispose();
   }
}

int main( char[][] argv)
{
   Hello.run();
   return 0;
}
Mar 14 2006