Robert Meek wrote:
> I had tried mixing the virtual key code and GetkeyState together as
> you show but of course it didn't work until I saw your example and added
> the
> rest of the evaluation: "and $80)>0".  That did the trick, unfortunately I
> don't know exactly what it is you are doing here.

GetKeyState returns a Byte. As the documentation states, if the high-order
bit is set, then it means the key you asked about is currently down, the
"and $80" masks out all the other bits. If the one remaining bit is set,
then the result will be non-zero.

> It seems like you are
> checking to see if the F1 Key is down, but if so then why is "if
> (key=VK_F1)" even necessary? Wouldn't it be redundant as this is in the
> OnKeyDown event?

Uh, because the OnKeyDown method gets called for *all* the keys. You only
want to do the test for one key, F1. Otherwise, you'll be checking for
*any* key being pressed while the Shift key is down.


-- 
Rob


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to