Re: [Pyobjc-dev] Returning BOOLs to Cocoa
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-07-23 05:45:01
|
On Tuesday, 22 July, 2003, at 23:27, Bob Swerdlow wrote: > I hate to be a pain, but AppKit does not seem to include > "NSWIndowDelegate" - get an ImportError: cannot find name > NSWindowDelegate. > I can call setDelegate_ without the multiple inheritence and there is > no > error, but the delegate functions don't respond. :-( I should have checked this in a 0.9 tree, 0.9 doesn't even include a definition of this protocol. That leaves us one alternative: even more explicit markup. Add 'windowShouldClose_ = objc.selector(windowShouldClose_, signature="c@:@")' just below the definition of the method. This will tell the bridge that this method returns a boolean instead of an object. class MyDelegate (AutoBaseClass): # .... def windowShouldClose_(self, sender): return 0 windowShouldClose = objc.selector(windowShouldClose, signature="c@:@") Another thing that will probably work: return None if the window shouldn't close and any other value if it should. Ronald > > > ----- Original Message ----- > From: "Ronald Oussoren" <ous...@ci...> > To: "Bob Swerdlow" <rsw...@tr...> > Cc: <pyo...@li...> > Sent: Tuesday, July 22, 2003 3:41 PM > Subject: Re: [Pyobjc-dev] Returning BOOLs to Cocoa > > >> >> On Tuesday, 22 July, 2003, at 20:38, Bob Swerdlow wrote: >> >>> Ronald - >>> >>> We are using 0.9 and hope to release soon, so I haven't wanted to >>> upgrade to >>> 1.0b1 just yet. However, when I add the call as you describe, Python >>> tells >>> me "No attribute addDelegate_". Is there some module I need to >>> include? >> >> The method is called setDelegate_, sorry about that. The other thing >> you'll >> have to do is multiple inherit the delegate from NSWindowDelegate >> (should be in AppKit), e.g. 'class MyClass (AutoBaseClass, >> NSWindowDelegate)'. >> >> PyObjC 0.9 was the last release where this was necessary. We then came >> to >> our senses and automaticly detected which protocols you're >> implementing >> :-) >> >> Ronald >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: VM Ware >> With VMware you can run multiple operating systems on a single >> machine. >> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at >> the >> same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 >> _______________________________________________ >> Pyobjc-dev mailing list >> Pyo...@li... >> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >> >> > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: VM Ware > With VMware you can run multiple operating systems on a single machine. > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |