I need to return a string from a treeview gadget node, after expandig/collapsing tree
Here is the code I'm having problems (i would like the string to appear for instance in the textfield gadget):
' EXAMPLE CODE
Strict
Local win:TGadget=CreateWindow("My win",50,50,240,340)
Local txt:TGadget=CreateTextField(10, 240, 180,20,win)
Local treeview:TGadget=CreateTreeView(0,0,200,200,win)
SetGadgetLayout treeview,2,2,2,2
Local root:TGadget=TreeViewRoot(treeview)
Local help:TGadget=AddTreeViewNode("Help",root)
AddTreeViewNode "topic 1",help
AddTreeViewNode "topic 2",help
AddTreeViewNode "topic 3",help
Local projects:TGadget=AddTreeViewNode("Projects",root)
AddTreeViewNode "project 1",projects
AddTreeViewNode("project 2",projects)
AddTreeViewNode("project 3 is a big waste of time",projects)
Repeat
WaitEvent()
'Print CurrentEvent.ToString()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_GADGETACTION
Local Node:TGadget = SelectedTreeViewNode(treeview)
Local s:String=String(Node.Context)
If s > ""
'SetStatusText(win,s)
SetGadgetText(txt,s)
End If
ExpandTreeViewNode(Node)
End Select
Forever
End
Here is the code I'm having problems (i would like the string to appear for instance in the textfield gadget):
' EXAMPLE CODE
Strict
Local win:TGadget=CreateWindow("My win",50,50,240,340)
Local txt:TGadget=CreateTextField(10, 240, 180,20,win)
Local treeview:TGadget=CreateTreeView(0,0,200,200,win)
SetGadgetLayout treeview,2,2,2,2
Local root:TGadget=TreeViewRoot(treeview)
Local help:TGadget=AddTreeViewNode("Help",root)
AddTreeViewNode "topic 1",help
AddTreeViewNode "topic 2",help
AddTreeViewNode "topic 3",help
Local projects:TGadget=AddTreeViewNode("Projects",root)
AddTreeViewNode "project 1",projects
AddTreeViewNode("project 2",projects)
AddTreeViewNode("project 3 is a big waste of time",projects)
Repeat
WaitEvent()
'Print CurrentEvent.ToString()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_GADGETACTION
Local Node:TGadget = SelectedTreeViewNode(treeview)
Local s:String=String(Node.Context)
If s > ""
'SetStatusText(win,s)
SetGadgetText(txt,s)
End If
ExpandTreeViewNode(Node)
End Select
Forever
End