Notifications
Clear all

[Closed] combineEnums and key board

 PEN

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?

6 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

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

 PEN

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.


if control.modifierKeys == (dotnet.combineEnums control.modifierKeys.Control control.modifierKeys.Shift) do ...

it always worked for me

 PEN

Hmm, wasn’t working here.

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

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

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.