Ooops
November 25, 2020, 07:18:00 AM

Author Topic: [bb] Trapping the ENTER keypress by UUICEO [ 1+ years ago ]  (Read 544 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
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
  1. dType = False
  2. win = CreateWindow("test",0,500,400,400,0)
  3. tbox = CreateTextArea(0,0,200,100,win)
  4. gbox = CreateTextField(0,102,200,20,win)
  5. HotKeyEvent 28,0,$028,0,0,0,0,win
  6. Repeat
  7. id = WaitEvent()
  8.         Select id
  9.                 Case $028
  10.                         If (Not dType) id = 0:Goto badreturnkeypress
  11.                         Stop
  12.                 Case 260; ENTER Key press ID when in a text field
  13.                         If (Not dType) id = 0:Goto badreturnkeypress
  14.                         Stop
  15.                 Case $401
  16.                         dType = False
  17.                         If (Not dType) And EventSource() = tbox dType = True:Stop
  18.                         If (Not dType) And EventSource() = gbox dType = True
  19.                 Case $803
  20.                         Exit
  21. .badreturnkeypress
  22.         End Select
  23. Forever
  24.  
  25. End


Comments :


Jammer429(Posted 1+ years ago)

 damn fine code


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal