Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add shift+click or control+click event to form?

Status
Not open for further replies.

fumbles

Programmer
Dec 9, 1999
43
US
Hi all, Happy Holidays!

Can anyone point me to a faq or give me a quick hint on adding shift+click function to my textbox class. I am already using rightclick, click, and doubleclick events.

Thanks in advance...

Steve
 
Steve,
You can't add "Events" in FoxPro. You can add Methods, and Properties.
Now, that said, I imagine that in theory (I haven't tried this myself), you might be able to use the Click event with some clever code, to mimic a seperate "SHIFT+Click" event, if you check for the presence of a Shift key press at the time the click event occurs. (Using the INKEY()) value. You could then do something like:

IF INKEY(<Shift, Ctrl, Whatever>)
Do something
ELSE
Do something else...
ENDIF

Or, put it in a CASE, if you have more than one. The only thing I'm not certain of is the dectection of the SHIFT key in the INKEY() function. (I'm not at a machine that I have VFP installed on, so I can't look up the function). But, it's a thought. Maybe that will lead you to some other solution if it does not work.

Best Regards,
Scott

&quot;Everything should be made as simple as possible, and no simpler.&quot;[hammer]
 
Scott -

Thanks for your help. I could not get inkey() to do what I wanted but I am having much more success with the mousedown event. It will distinguish the state of the click.

Looking for &quot;gotchas&quot; now. If anyone knows of any please let me know.

Thanks again

Steve
 
fumbles

An alternative method using a WinAPI call

#DEFINE VK_lSHIFT 0x10
#DEFINE VK_lCONTROL 0x11

DECLARE INTEGER GetKeyState IN WIN32API INTEGER

DO CASE
CASE GetKeyState(VK_lSHIFT) < 0 ;
[tab]OR GetKeyState(VK_lSHIFT) > 1 && Check for shift key press
* Code
CASE GetKeyState(VK_lCONTROL) < 0 ;
[tab] OR GetKeyState(VK_lCONTROL) > 1 && Check for control key press
* Code
OTHE
* Code
ENDC
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top