Quick example here:
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.
; 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.