PDA

View Full Version : combineEnums and key board


PEN
09-18-2009, 07:09 PM
I want to check of both ctrl and alt are held down. I'm using "system.windows.forms.control" and testing the modifierKeys property. I can get it to work for one or the other but not both. I assume that I should be using combineEnums and that works but I don't know how to test against it. Anyone know?

denisT
09-18-2009, 07:33 PM
I want to check of both ctrl and alt are held down. I'm using "system.windows.forms.control" and testing the modifierKeys property. I can get it to work for one or the other but not both. I assume that I should be using combineEnums and that works but I don't know how to test against it. Anyone know?


dotnet.combineEnums control.modifierKeys.Control control.modifierKeys.Shift ...

PEN
09-18-2009, 07:50 PM
Yes, I know how to combine them, now how do you test that?

if control.modifierKeys==??

Didn't appear to be working if I tested the result of the conbineEnums.

denisT
09-18-2009, 07:55 PM
if control.modifierKeys == (dotnet.combineEnums control.modifierKeys.Control control.modifierKeys.Shift) do ...


it always worked for me

PEN
09-18-2009, 08:08 PM
Hmm, wasn't working here.

OK will setup a simple example to see if that will work. Thanks

SyncViewS
09-20-2009, 03:16 PM
Hi Paul,
do you necessarily need it to be dotNet? You can query the modifier keys status with:

keyboard.shiftPressed
keyboard.controlPressed
keyboard.altPressed
keyboard.escPressed
- Enrico

PEN
09-20-2009, 03:23 PM
Well that is true, didn't even think of that to tell you the truth, just that I wrote the combineEnums out of habit and it didn't appear to work. Tested several times as well. I have since written a simple test and it worked fine. So now I just need to try and get it back working in the massive tool that I'm working on.

CGTalk Moderation
09-20-2009, 03:24 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.