Why my key are not tested ?

BlitzMax Forums/BlitzMax Programming/Why my key are not tested ?

Hi

Why my f... KEY_ENTER is not tested ???

Try to change this line : If event.data=KEY_UP Then
by this line : If event.data=KEY_ENTER Then

But the program made nothing ??? why ???

Strict

OnEnd VerifyQuit

Global MainWindow:TGadget = CreateWindow("Test", (Desktop().Width/2)-200,(Desktop().Height/2)-200,400,400)
Global TextField1:TGadget = CreateTextField(10,10,120,24,MainWindow)
ActivateGadget(TextField1)
SetGadgetFilter(TextField1, TextField1Filter)

Main()

End


Function Main()

While True
	WaitEvent()
	
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select

Wend

End Function


Function VerifyQuit()
	If Proceed("Are you sure you want to quit?")<> 1 Then 
		OnEnd VerifyQuit
		main()
	EndIf
End Function


Function TextField1Filter(Event:TEvent, Context:Object)
	Select event.id
		Case EVENT_KEYDOWN
			If event.data=KEY_UP Then
				End
			EndIf
	End Select
	
	Return 1
End Function


Because Key_enter has an internal importance on textfields and textareas (-> line break) and thus don't fire an event. (there are some other keys that behave similar)

And there is absolutely no solution ?????
because i want test the return key from
a textfield url for an internal web browser.

No not unless you modify the underlying C sources or skid decides to change that. (think there was a thread on that, just can't remember in which board.)

Arghh! !! many thanks Dreamora... :)

I'm sorry.
I've to correct myself.

Return only does not fire event on TextField.
BUT it works on textarea at least on the Filter, so you might try to use that for a similar solution (as you can fully surpress linebreaks by the filter)