[bb] Trapping the ENTER keypress by UUICEO [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:41

Previous topic - Next topic

BlitzBot

Title : Trapping the ENTER keypress
Author : UUICEO
Posted : 1+ years ago

Description : Use the following code to trap the users enter key (great for text field enter key press traps)

Code :
Code (blitzbasic) Select
dType = False
win = CreateWindow("test",0,500,400,400,0)
tbox = CreateTextArea(0,0,200,100,win)
gbox = CreateTextField(0,102,200,20,win)
HotKeyEvent 28,0,$028,0,0,0,0,win
Repeat
id = WaitEvent()
Select id
Case $028
If (Not dType) id = 0:Goto badreturnkeypress
Stop
Case 260; ENTER Key press ID when in a text field
If (Not dType) id = 0:Goto badreturnkeypress
Stop
Case $401
dType = False
If (Not dType) And EventSource() = tbox dType = True:Stop
If (Not dType) And EventSource() = gbox dType = True
Case $803
Exit
.badreturnkeypress
End Select
Forever

End


Comments :


Jammer429(Posted 1+ years ago)

 damn fine code