More tree view EVENT_GADGETOPEN

BlitzMax Forums/BlitzMax Programming/More tree view EVENT_GADGETOPEN

Hey All,

Anybody work out how to get at the tree view node that is associated with the open and close events.

SelectedTreeViewNode is no goo because a node doesn't need to be selected to expand and contract it.

Any help would be much appreciated.

Oh yeah.. I'm trying to change the icon of the expanding tree view node.

Type TTest
	Field Name:String
End Type


Global window:TGadget = CreateWindow("Tree Test",200,200,210,420)

Global Tree_View:Tgadget = CreateTreeView(5,5,200,200,Window)
Global Text:TGadget = CreateTextArea(5,205,200,200,Window)

Tree_View.Text = "Tree"

Global Root:TGadget = TreeViewRoot(Tree_View)
Root.Text = "Root"

		
For Local X:Int = 0 To 10		
T1:TGadget = AddTreeViewNode("Root"+X,Root)
Local T:TTest = New TTest
T.Name = "Root"+X
T1.Context = T

For Local Y:Int = 0 To 10 
	T2:TGadget = AddTreeViewNode("Test"+Y,T1)
	T:TTest = New TTest
	T.Name = "Test"+Y
	T2.Context = T

Next
Next


While True
	WaitEvent 
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case Event_GadgetSelect
			Local Tree:TGadget = TGadget(EventSource())
			If Tree <> Null Then
				If  SelectedTreeViewNode(Tree) <> Null Then 
					'Local Name:String = SelectedTreeViewNode(Tree).Text	
					Local Node:Tgadget = SelectedTreeViewNode(Tree)
					Local NAme:String = TTest(NOde.Context).name
					AddTextAreaText(Text,Name+"~n")
					Print Name
				EndIf
			EndIf
			
			Tree = Null
		Case Event_GadgetOpen
			Local Tree1:TGadget = TGadget(EventExtra())
			AddTextAreaText(Text,Tree1.Text + " is opened !~n")
			
		Case Event_GadgetClose
			Local Tree2:TGadget = TGadget(EventExtra())
			AddTextAreaText(Text,Tree2.Text + " is closed !~n")

		End Select
Wend



with Event_GadgetOpen and Event_GadgetClose you get the Tree. and with EventExtra you get the right node.

Oh.. extra! thanks klepto.

Is this stuff documented?

It was only modified recently and should be documented in the CreateTreeView help.