Re: [Pyobjc-dev] Returning BOOLs to Cocoa
Brought to you by:
ronaldoussoren
From: Bob S. <rsw...@tr...> - 2003-07-22 18:38:25
|
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? Thanks for your help. - Bob ----- Original Message ----- From: "Ronald Oussoren" <ous...@ci...> To: "Bob Swerdlow" <rsw...@tr...> Cc: <pyo...@li...> Sent: Tuesday, July 22, 2003 1:56 PM Subject: Re: [Pyobjc-dev] Returning BOOLs to Cocoa > > On Tuesday, 22 July, 2003, at 18:31, Bob Swerdlow wrote: > > > I seem to be missing something about BOOLs returned from python members > > called for Cocoa delegates. :-( > > > > I implemented a Cocoa delegate for my window to support > > windowShouldClose_( ) since I need to do some checking of user input > > before > > I allow the window to close. However, no matter what I return, the > > window > > always closes. > > > > Originally, I just used: > > return 0 > > but I also tried: > > return objc.NO > > > > I added a print statement for when the code returns objc.NO and it > > printed: > > returning FALSE > > > > What is the proper value to return so that Cocoa knows I don't want it > > to go > > on? > > Returninging 0, False or objc.NO should work. Are you using PyObjC > 1.0b1? If you're using the 0.9 release, you have to tell the bridge > that you intent implement a window delegate. > > I added 'self.tableView.window().addDelegate_(self)' in 'awakeFromNib' > and the following method to the TableView example and that works as > expected. > > def windowShouldClose_(self, sender): > """ Window won't close """ > print "Should Close?" > return 0 > > > 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 > > |