[MAXGUI] Combobox with default text?

BlitzMax Forums/BlitzMax Beginners Area/[MAXGUI] Combobox with default text?

The only way I could do it was to set the COMBOBOX_EDITABLE style and then using SetGadgetText$() as in the below example:
Global wndMain:TGadget = CreateWindow("Test",400,400,400,300,0,15)
	Global gadCombo:TGadget = CreateComboBox(5, 5, 200, 20, wndMain, COMBOBOX_EDITABLE)
	Global gadButton:TGadget = CreateButton("OK",210,5,40,20,wndMain)

' Adding example items to the combobox

For Local a:Byte = 0 To 20

	AddGadgetItem(gadCombo,"Item " + a)

Next

'Setting default text

SetGadgetText(gadCombo, "Please Select an Option...")

'Main Program Loop

Repeat

	Select WaitEvent()
	
		Case EVENT_WINDOWCLOSE;End
		
	End Select

Forever
Is that any good?


Seb

P.S. The problem with that is that the user can write anything into the box unless you write a validation routine yourself.

Update: I attempted to write for you a sample validation routine but it wouldn't work as I can't find a cross-platform way to retreive what the user has typed into an editable combo box. TextFieldText$() doesn't appear to update itself when a user types something in. :-) Anyone else have this problem, I have BlitzMax 1.20 running on Windows XP with latest SyncMods...