Getting Enter key keypress on a TextField gadget

BlitzMax Forums/BlitzMax GUI Programming/Getting Enter key keypress on a TextField gadget

Is there any way of getting the enter key of a text field gadget?

I have tried a hotkey I have tried the Key events and nothing seems to work it always looses focus when I press enter an no event is created.

If you mean somebody types in a textfield, then hits enter... create a button then hide it:-

Strict 

Local window:TGadget
Local textfield:TGadget
Local button:TGadget

window=CreateWindow("My Window",30,20,320,200)

textfield=CreateTextField(4,4,120,22,window)
SetGadgetText( textfield,"A textfield gadget" )

' we need an OK button to catch return key
button=CreateButton("OK",130,4,80,24,window,BUTTON_OK)
HideGadget button

While WaitEvent()
	Select EventID()
	Case EVENT_GADGETACTION
		Select EventSource()
			Case button
				Print "return key"
		End Select
	Case EVENT_WINDOWCLOSE
		End
	End Select
Wend


Minced up version from the docs.

Dabz

Why not use SetGadgetFilter ?

Why not use SetGadgetFilter ?

like this:

http://www.blitzbasic.com/Community/posts.php?topic=55626#619096