Textfields and RETURN key

BlitzPlus Forums/BlitzPlus Programming/Textfields and RETURN key

EOF(Posted 2006) [#1]
I'm sure this used to work ..
; Textfield - RETURN/ENTER

win=CreateWindow("TextField - Change Contents",270,240,234,104,Desktop(),1)
tf=CreateTextField(20,20,160,20,win,0)
ActivateGadget tf

Const MAXCHARS=14

Repeat
	ev=WaitEvent()
	Select ev
		Case $803 ; close [X]
		Exit
		Case $401 ; gadgethit
		If EventSource()=tf ; textfield
			; limit text characters
			SetGadgetText tf,Left$(TextFieldText$(tf),MAXCHARS)
			DebugLog EventData()
			; RETURN pressed
			If EventData()=13 SetGadgetText tf,"plop"
		EndIf
	End Select
Forever
End

Can't seem to pick up the RETURN/ENTER keys anymore(?)


Pineapple(Posted 2006) [#2]
Yep, somethings happened... I tried the code using just the setup version, and it picked it up... Though once updated to 1.41 it doesnt work!

Dabz


Andres(Posted 2006) [#3]
You can try using a button with flag 4:
4 - A push button that is automatically clicked by a 'return' keystroke


Sonari Eclipsi Onimari(Posted 2006) [#4]
I'd make a button that is a 1x1 pixel somwhere hidden and have its flag set to 4 and then do your processing like Andres said...