Bugged Editable ComboBox w/ Event-Hooks

Archives Forums/MaxGUI Bug Reports/Bugged Editable ComboBox w/ Event-Hooks

USNavyFish(Posted 2009) [#1]
Example program demonstrates the issue.

Compile and run. Select different items in the non-editable box, and note the Event.Data output to the console. Looks normal - the index 0,1,or 2 appears.

Now select different items in the editable box, and again note the Event.Data output to the console. Instead of printing just Event.Data once, the program Event.Data, then -1, then Event.Data again.

SuperStrict
Import MaxGUI.Drivers

Global Window:TGadget = CreateWindow("",0,0,200,80,Desktop(),WINDOW_CENTER|WINDOW_TITLEBAR|WINDOW_STATUS|WINDOW_CLIENTCOORDS)
SetStatusText(Window,"Observe Console for Event.Data")

Global SectionLabel:TGadget = CreateLabel("Regular TGadgets",0,0,200,20,Window,LABEL_FRAME|LABEL_CENTER)

Global Label:TGadget = CreateLabel("Non-Editable",0,25,100,20,Window)
Global Label2:TGadget = CreateLabel("Editable",100,25,100,20,Window)
Global Combo:TGadget = CreateComboBox(0,45,100,40,Window)
	AddGadgetItem(Combo,"One",GADGETITEM_DEFAULT)
	AddGadgetItem(Combo,"Two")
	AddGadgetItem(Combo,"Three")
	
Global ComboEdit:TGadget = CreateComboBox(100,45,100,40,Window,COMBOBOX_EDITABLE)
	AddGadgetItem(ComboEdit,"Four",GADGETITEM_DEFAULT)
	AddGadgetItem(ComboEdit,"Five")
	AddGadgetItem(ComboEdit,"Six")



AddHook EmitEventHook,EventManager

While Not AppTerminate()
	WaitEvent()
Wend

Function EventManager:Object(ID:Int,Data:Object,Context:Object)

	Local Event:TEvent = TEvent(Data)
		
	Select Event.ID		
	
	Case EVENT_GADGETACTION
		Print Event.Data
			
	Case EVENT_WINDOWCLOSE
		End
		
	End Select		
	
End Function