Modifier keys to mouse events

Can someone point me to a sample code where events involving both the mouse and modifier keys (CTRL, alt, etc…) are caught. For example: mouse1 and shift. Is there an event naming convention to catch these or more has to be done?


not, catch shift store it then catch mouse.

I’ve found that catching modifier key events don’t really go well. I recommend using mindstormss’ key polling class to do this. A little gotcha with the class is that it doesn’t follow the panda naming conventions when you get the mouse buttons. Instead of mouse1, mouse2, mouse3 its left, right and middle respectively.

I believe that the regular base.accept() adds the modifyer to the beginning, like ‘shift-k’ so to accept regular k base.accept(‘k’,someFunc) and to accept shift and k base.accept(‘shift-k’,someFunc). There are various ways to stop this behavior of modifyers changing the event name and make shift/control work like regular keys, but any one of them does not seem to work 100% of the time. The only way I have found that seems to work to get rid of the modifyers is to make your own events for the keys/mouse that doesn’t include the shift and then use those, and this is what I use in the key polling class. see the init method for that…

Hope this was semi useful…

(and I renamed the mouse buttons because I could never remember which mouse# was which button…its easy to fix…)

Right, treeform is wrong. You can catch shift-mouse1 or shift-mouse2 quite well, unless you cleared the modifierbuttons for the mousewatcher.