Getting access to ModifierKeys state

0
0

Hi,

I’ve been trying to get the current state of the modifier keys (CTRL/SHIFT/ALT) but the ModifierKeys property always returns None even though there is a modifier key pressed.  Is there a special way to access the property values?

  • You must to post comments
0
0

Hi Andrew,

logged as WJ-8848 and added to the latest Wisej release (1.4.79).

Best regards
Frank

  • You must to post comments
0
0

Works for single modifiers. It reverts to None when there are more than 1 pressed. Logged the bug as WJ-8846.

To read the modifiers you need to handle at least one keyboard event. While processing the event you can either use the event args or the global Control.ModifierKeys property.

  • Andrew Hills
    Thanks Luca. I got it working in KeyDown/KeyUp at the form level but I have to click on the form first then press CTRL or SHIFT. I was trying to get the modifier values during a left mouse click on a control so I could multi-select some controls at runtime but it doesn’t appear to work.
  • Luca (ITG)
    It cannot work. It’s impossible in javascript to query the keyboard outside of a keyboard event.
  • Luca (ITG)
    I’m wrong. The pointer event carries the keyboard state as well. Will add it to the mouse event handler.
  • Andrew Hills
    Excellent, that would be great, thanks Luca.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.