[Pyobjc-dev] NSBeginAlertSheet trouble
Brought to you by:
ronaldoussoren
From: Dinu G. <gh...@da...> - 2003-06-18 12:12:04
|
Hi, I also have some trouble with sheets... apparently the specified se- lectors are not called properly by an alert sheet, although calling the selectors manually using performSelector_withObject_withObject_() seems to work ok (ideally one would need another withObject_ parameter, though...). This is the function intended to make a sheet: def makeAlertSheet(title, msg, info, window, delegate, default=None, alternate=None, other=None): endSel = NSSelectorFromString("sheetDidEnd:returnCode:contextInfo:") dismissSel = NSSelectorFromString("sheetDidDismiss:returnCode:contextInfo:") # the following prints 1 (ok, same for dismissSel) print "respondsToSelector_", delegate.respondsToSelector_(endSel) # the following prints something like <NSWindow: 0xc2dcc0> 99 99 # (sort of ok, same for dismissSel) delegate.performSelector_withObject_withObject_(endSel, window, 99) # this crashes when clicking the OK button in the sheet NSBeginAlertSheet(title, default, alternate, other, window, delegate, endSel, dismissSel, info, msg) Here are the methods intended to be called by the sheet: class MyDocController(...): def sheetDidEnd_returnCode_contextInfo_(self, sheet, returnCode, info): print "sheetDidEnd_returnCode_contextInfo_", sheet, returnCode, info def sheetDidDismiss_returnCode_contextInfo_(self, sheet, returnCode, info): print "sheetDidDismiss_returnCode_contextInfo_", sheet, returnCode, info And this is how the function is called on the top-level (info==0 b/c "an integer is required"...): makeAlertSheet("title", "msg", 0, theWindow, self) Any clue? Thanks, Dinu -- Dinu C. Gherman ...................................................................... "One of the great things about books is sometimes there are some fantastic pictures." (George W. Bush, 3 Jan. 2000) |