ETO detect Ctrl KeyDown on button.Click event

Hi @dale, @curtisw,

I am trying to detect when a user clicked on a button while the CTRL key was pressed. In WinForms this can be done like this in the button.Click event:

def MyOnButtonClickEvent(self, sender, e):
    if sender.ModifierKeys == Keys.Control: 
        print "CTRL was down"

however in the Eto framefork i cannot find a ModifierKeys property. So i’ve set up some KeyDown and KeyUp events for the button but it seems the events are only fired for non modifier keys or if a non modifier key is pressed together with a modifier key.

How can i detect only a modifier key (CTRL) down in the button.Click event or in a button.KeyDown event ?

_
c.

Hi @clement,

To get the current modifier state for keys, such as Ctrl, Alt, and Shift, just call Eto.Forms.Keyboard.Modifiers.

– Dale

@dale, thanks. It works !

_
c.