SetGadgetFilter issue

BlitzMax Forums/MaxGUI Module/SetGadgetFilter issue

BLaBZ(Posted 2010) [#1]
I keep receiving the error message

Unable to convert from 'Int(brl.event.TEvent,Object)' to 'Int(TEvent,Object)'


Called....
SetGadgetFilter(me_MenuName_Textfield, Self.Menus_Tab_AddMenu_Filter)
The filter....
Method Menus_Tab_AddMenu_Filter(event:TEvent,context:Object)



d-bug(Posted 2010) [#2]
Menus_Tab_AddMenu_Filter has to be a function.


BLaBZ(Posted 2010) [#3]
Great! It works...with every key except the one I want.... the Enter Key......

Function Menus_Tab_AddMenu_Filter(event:TEvent,context:Object)
		Select event.id
			Case EVENT_KEYDOWN
				Notify "it works!"
		End Select
	End Function 



d-bug(Posted 2010) [#4]
Oh, I see, for this you have to react on EVENT_KEYCHAR. something like that:
SuperStrict

Import maxgui.drivers

Global window:TGadget = CreateWindow ("test", 100, 100, 300, 100, Null)

Local textf:TGadget = CreateTextField(5,5,290,24,window)
SetGadgetFilter(textf, filter)


Repeat
	Select WaitEvent()
		Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE
			End
	End Select

Forever

Function filter:Int(event:TEvent,context:Object)
	Select event.id
		Case EVENT_KEYCHAR
			Select event.data
				Case KEY_ENTER
					SetGadgetText(window, "test :: hurray!")
					Return True
			End Select
	End Select
	SetGadgetText(window, "test")
	Return True
End Function