[solved] ctrl + mouse click

I am trying to capture a ctrl mouse click.

My naive first attempt was to capture the mouse click and ctrl key state separately using events…

self.accept("mouse1", self.pick)      
self.accept("mouse1-up", self.release) 
self.accept("control",self.controlKeyDown)
self.accept("control-up",self.controlKeyUp)

… and storing the mouse and ctrl key states.

This works if you click then hit ctrl, but not the other way around, which is the more natural way to do it.

A quick look through the reference manual seems to suggest that ctrl-clicks are handled differently. So how do I capture them?

Thanks.

self.accept("control-mouse1", self.pick)     
self.accept("mouse1-up", self.release) 

Note that the control-prefix is applied to the button-down message, but not to the button-up message (because the user may or may not have released the control key by the time they release the mouse1 button).

David

Sorry, found the answer in the manual (always happens just after you post a question).

One solution is to turn off modifier key events using:

base.mouseWatcherNode.setModifierButtons(ModifierButtons())
base.buttonThrowers[0].node().setModifierButtons(ModifierButtons())