I have a Reporter dialog with some options and I want to press the spacebar to see the quick fill preview without needing to click the edit view. Just like if you run a Filter you can still press spacebar for the preview. I tried to override keyDown_ in the dialog and that works to capture the spacebar event, but when I try to propagate it to the edit view or wherever it doesn’t do anything. I’m probably sending the event to the wrong place. I also see on the app object there are spaceDown and setSpaceDown_ methods. Are those to do with spacebar handling?
Implement this method:
def flagsChanged_(self, theEvent):
if theEvent.keyCode() == 49:
NSDocumentController.sharedDocumentController().currentDocument().windowController().flagsChanged_(theEvent)
or if you already have a reference to the current font
def flagsChanged_(self, theEvent):
if theEvent.keyCode() == 49:
self.font.parent.windowController().flagsChanged_(theEvent)
(I typed this in Safari)
Just implementing flagsChanged_
doesn’t do anything for me, but if I check for the space key in my keyUp_
and keyDown_
and then pass the event to self.font.parent.windowController().flagsChanged_(theEvent)
it works perfectly.