MaxGUI Upgrade

BlitzMax Forums/BlitzMax GUI Programming/MaxGUI Upgrade

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.

MaxGUI 1.15 looks like it is up on syncmods, hopefully includes a fix for win32 menuitems not appearing as event source and a new SetDataSource method for gadgets. Currently in development it lets you do the following sort of thing, with items being fetched from string arrays or object lists (which are converted from result of enumerating ToString() on each member).

Currently only works with container gadgets but I'd like to extend it to work for menu and node trees. I have an idea for a matching SetStyleSource interface but will do some more testing on that one.

The implementation should be able to maintain coherency quite efficiently between the itemlist and your datasource so small modifications anywhere on a large data set should sync quickly. Unfortunately you do need to call SetDataSource again after modifying your list or array but this should be a relatively snappy operation if the data has not changed significantly:

Strict 

Local window:TGadget
Local listbox:TGadget

window=CreateWindow("My Window",30,20,200,400)
listbox=CreateListBox(0,0,ClientWidth(window),ClientHeight(window),window)
SetGadgetLayout listbox,1,1,1,1

listbox.SetDataSource AudioDrivers()

While WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
			
		Case EVENT_GADGETSELECT
			Local i=EventData()		'what got selected?
			If i=-1 Exit			'test for deselection			
			Local src$[]			'a string array to test eventextra
			src=String [] EventExtra()	'cast datasource to string array
			Notify "Select:"+src[i]	'combine datasource and index

		Case EVENT_WINDOWCLOSE
			End
		
	End Select
Wend