PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on January 21, 2010, 11:17:37 PM

Title: trouble trapping two keys presses
Post by: Martin Francom on January 21, 2010, 11:17:37 PM
I need to prevent a user from entering in any TEXTBOX on the FORM either of these characters:    ^   ~

I know I can trap them in the EN_CHANGE for each Textbox but was hoping I could trap them in the FF_PUMPHOOK Function.   There doesn't appear to be a %VK_  for those characters probably because the require the shift key to type them.

Any suggestions how I can trap them and not allow them to type into any Textbox on the form. ???
Title: Re: trouble trapping two keys presses
Post by: Roger Garstang on January 22, 2010, 12:38:13 AM
Haven't tested, but in inc file:

%VK_OEM_3        = &HC0   ' "`~" for US

The other would probably need to check for 6 key with Shift.  May be easier to wait and get the Char instead of Keypresses using WM_CHAR.

If you use FF's built in WM_CHAR for the textbox the chCharCode will be the ascii of the char. Something like below will block the 'a' key:

If chCharCode = 97 Then Function = 1

You will need to handle when they paste too or block it.

Textbox custom:
If wMsg = %WM_PASTE Then Function = 1
Title: Re: trouble trapping two keys presses
Post by: Martin Francom on January 22, 2010, 02:07:28 PM
Thanks Roger.   I will play with those suggestions tonight. And if I can make them work.
Title: Re: trouble trapping two keys presses
Post by: Gary Stout on January 22, 2010, 08:20:07 PM
It looks like the shift key is &H10 and the tilde is &H7E and ^ is &H5E. These are all for keypress. The keyUp code changes for the 2 keys (&HC0 and &H36 respectively).

Maybe this will get you started.

Gary