Re: [Pyobjc-dev] Cocoa Sheets
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-06-11 18:07:06
|
On Wednesday, Jun 11, 2003, at 18:22 Europe/Amsterdam, Bob Swerdlow wrote: > I'm trying to use > NSApplication.beginSheet_modalForWindows_modalDelegate_didEndSelector_c > ontex > tinfo_ to create a sheet on a window, but I don't seem to be setting > it up > right . When it goes to call the didEndSelector method I get a bus > error :( I'm having no problems with NSOpenPanel..beginSheetForDirectory_file_types_modalForWindow_modalDeleg ate_didEndSelector_contextInfo_, which uses a simular protocol. > > > The method that I want called is defined in class MyClass as: > def sheedDidEnd_sheet_returnCode_contextInfo_(self, sheet, > returnCode, > contextInfo): > > I'm trying to invoke the sheet as: > > application.beginSheet_modalForWindow_modalDelegate_didEndSelector_cont > extin > fo( \ > self.panel, self.window, self, > sheedDidEnd_sheet_returnCode_contextInfo_selector, 0) > > where I have set up sheedDidEnd_sheet_returnCode_contextInfo_selector > with: sheedDidEnd_sheet_returnCode_contextInfo_selector = objc.selector \ (sheedDidEnd_sheet_returnCode_contextInfo_, signature='v@:@ii') That's the same as I'm using, it must be correct then :-) I don't think we have documentation for the signature strings in our documentation. They are equal to the signature strings used in the Objective-C runtime, and those a described in Apple's Objective-C manual. I think we should add a conviencefunction for this, something like 'NSSheetEndMethod'. Your code would then be something like the assignment below, without an ugly signature string. sheedDidEnd_sheet_returnCode_contextInfo_selector = NSSheetEndMethod( sheedDidEnd_sheet_returnCode_contextInfo_) Ah, now I see the problem: selector should be used like 'classmethod', the assigment in your code should read: sheedDidEnd_sheet_returnCode_contextInfo = objc.selector \ (sheedDidEnd_sheet_returnCode_contextInfo_, signature='v@:@ii') The result of the selector function should be assigned to the same name as the orignal function (e.g. dont add '_selector' to the name!). Ronald |