I have a secondary window (a sheet) for a dialog controlled by a secondard WindowController. For some reason, the actions never get called in NSObject subclass after the sheet is displayed. I have confirmed and re-linked the actions. The code runs to runModalForWindow_ but then never receives the ok or cancel actions. So the sheet never goes away. What am I missing here? I cant seem to find any pyobjc examples on thier website that does a runModalForWindow_...
@objc.IBAction
def okSelected(self, sender):
self.dialogResult = objc.YES
NSLog("OK")
#NSApp.endSheet_(self.newTurnWindowOutlet)
NSApp.stopModalWithCode_(objc.OK)
@objc.IBAction
def cancelSelected(self, sender):
self.dialogResult = objc.NO
#NSApp.endSheet_(self.newTurnWindowOutlet)
NSApp.stopModalWithCode_(objc.NO)
def runSheet(self, parent):
NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_(
self.newTurnWindowOutlet, parent, None,
self.sheetDidEnd_returnCode_contextInfo_, None)
NSLog("runModelForWindow")
result = NSApp.runModalForWindow_(self.newTurnWindowOutlet)
NSLog(str(result))
NSApp.endSheet_(self.newTurnWindowOutlet)
self.newTurnWindowOutlet.orderOut_(self)
return self.dialogResult