checking ENTER

BlitzPlus Forums/BlitzPlus Programming/checking ENTER

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Quick example here:

; Textfield - ENTER/RETURN
win=CreateWindow("TextField + ENTER/RETURN",270,240,234,104,Desktop(),1)
tf=CreateTextField(20,20,160,20,win,0)

Repeat
	ev=WaitEvent()
;	DebugLog "Event = $"+Right$(Hex$(ev),4) + "   "+EventSource() + "   "+EventData()
	If EventSource()=win ActivateGadget win
	Select ev
		Case $803 ; close [X]
		Exit
		Case $401 ; gadgethit
		If EventSource()=tf ; TEXTFIELD
			If EventData()=13 Notify "ENTER/RETURN pressed in textfield"
		EndIf
	End Select
Forever

End

The RETURN/ENTER detection only works whilst editing in the textfield. Clicking the window area deactivates the textfield and likewise the RETURN/ENTER key detection.