Treeview gadgets don't work?

BlitzMax Forums/MaxGUI Module/Treeview gadgets don't work?

Ked(Posted 2008) [#1]
This example shows that the added nodes are not being seen when added.
SuperStrict
Import Maxgui.drivers


Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400)
Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow)

Local files:String[]=LoadDir(BlitzMaxPath())
Local File:String
For file = EachIn files
    AddTreeViewNode(file, MyTreeView) 
    Print "file added"
Next

Repeat
  WaitEvent()
  Select EventID()
  Case EVENT_WINDOWCLOSE
     End
  End Select
Forever
End



SebHoll(Posted 2008) [#2]
You need to wrap the treeview gadget with TreeViewRoot() for root nodes:

SuperStrict
Import Maxgui.drivers


Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400)
Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow)

Local files:String[]=LoadDir(BlitzMaxPath())
Local File:String
For file = EachIn files
    AddTreeViewNode(file, TreeViewRoot(MyTreeView)) 
    Print "file added"
Next

Repeat
  WaitEvent()
  Select EventID()
  Case EVENT_WINDOWCLOSE
     End
  End Select
Forever
End



Ked(Posted 2008) [#3]
Ah. Great. Thanks!