[MAXGUI] Treeview Refresh

BlitzMax Forums/MaxGUI Module/[MAXGUI] Treeview Refresh

Scaremonger(Posted 2007) [#1]
Can anyone help me with what looks like a refreshing problem?
Take the code below: When you double-click on a node in the Left treeview, it is added to the options on the Right treeview. Unfortunately the little [+] does not appear.

If you click on it, minimise/restore the window, drag it off the window and back on again, or resize the window; the option is visible so I'm guessing that all I need to do is redraw the Treeview; but how? Can I force a GadgetPaint action?

Strict 

Local window:TGadget=CreateWindow("My Window",50,50,410,240)
Local tvLeft:TGadget=CreateTreeView(0,0,200,200,window)
Local tvRight:TGadget=CreateTreeView(210,0,200,200,window)

SetGadgetLayout tvleft,2,2,2,2
SetGadgetLayout tvright,2,2,2,2

Local rootLeft:TGadget=TreeViewRoot(tvLeft)
Local rootRight:TGadget=TreeViewRoot(tvRight)

Local help:TGadget=AddTreeViewNode("Help",rootLeft)
AddTreeViewNode "topic 1",help
AddTreeViewNode "topic 2",help
Local projects:TGadget=AddTreeViewNode("Projects",rootLeft)
AddTreeViewNode "project 1",projects
AddTreeViewNode("project 2",projects)

Local options:TGadget=AddTreeViewNode("Options",rootRight)

While WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_GADGETACTION
			If EventSource() = tvLeft Then
				Local gad:TGadget = SelectedTreeViewNode( tvLeft )
				AddTreeViewNode( gad.getText(), options )
			End If
	End Select
Wend



Scaremonger(Posted 2007) [#2]
The minute I posted this, I got an idea... I trawled through the MaxGui module, looking for methods and found .Activate(). I looked at the options and found the magic number 13 was ACTIVATE_REDRAW... Hey-Presto...

I hope this saves someone else some time in the future...

	Case EVENT_GADGETACTION
		If EventSource() = tvLeft Then
			Local gad:TGadget = SelectedTreeViewNode( tvLeft )
			AddTreeViewNode( gad.getText() , options )
			tvRight.activate(ACTIVATE_REDRAW)
		End If