treeview problem...

BlitzMax Forums/BlitzMax GUI Programming/treeview problem...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

To be honest, you should change the concept. I don't think it's a good idea to create 200 Listboxes...
Nevertheless see below how your code works:



Import maxgui.drivers

Global mainwindow:TGadget=CreateWindow("window",200,200,500,500,Desktop())
Global BooklistTree:TGadget=CreateTreeView(0,0,200,300,mainwindow)
AddTreeViewNode("test",BooklistTree)
Local roottree:TGadget = AddTreeViewNode("Root", TreeViewRoot(BooklistTree),1)
Local count:Int
Local listbox:TGadget[200]
Local treebooklist:TGadget[200]
Local LastListbox:TGadget		'to be able to hide it
Repeat
	treebooklist[count]=AddTreeViewNode(String(count),roottree,0)
	listbox[count]=CreateListBox(200, 0, 300, 400, mainwindow)
		AddGadgetItem(ListBox[count],count)                 'just to see something
		HideGadget listbox[count]
		treebooklist[count].context=listbox[count]
	count=count+1
Until count=10

'....

Repeat
        Local W_Event:Int=WaitEvent()
	Select W_Event
              Case EVENT_GADGETSELECT
			Local E_Source:Object=EventSource()
			Select E_Source
				Case BooklistTree           'treebooklist
					DebugLog "Selected"
					Local Node:TGadget= SelectedTreeViewNode(booklisttree)
	       			' So what now ?
					If node
						If node.context
							If LastListbox HideGadget(LastListbox)
							ShowGadget(TGadget(node.context))
							LastListbox=TGadget(node.context)
						End If
					End If
	                End Select
             Case EVENT_WINDOWCLOSE End
       End Select
Forever