Re: Telling apart different save panels

2011-09-22 Thread Seth Willits
On Sep 20, 2011, at 6:00 PM, douglas welton wrote: I'm not sure that my solution is any less messy than what you have suggested, but... when faced with this same situation, I gave the save panel a different title each time it was invoked. When the panel object was passed to my delegate, I

Re: Telling apart different save panels

2011-09-22 Thread Graham Cox
On 23/09/2011, at 5:20 AM, Seth Willits wrote: On Sep 20, 2011, at 6:00 PM, douglas welton wrote: I'm not sure that my solution is any less messy than what you have suggested, but... when faced with this same situation, I gave the save panel a different title each time it was invoked.

Re: Telling apart different save panels

2011-09-22 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 9/22/11 3:34 PM, Graham Cox wrote: On 23/09/2011, at 5:20 AM, Seth Willits wrote: On Sep 20, 2011, at 6:00 PM, douglas welton wrote: I'm not sure that my solution is any less messy than what you have suggested, but... when faced with this

Telling apart different save panels

2011-09-20 Thread Graham Cox
In my app I have two places where a NSSavePanel is used to set up different sorts of file save. Using the modern 'block completion' approach, running the panels as sheets, the code is very nice, self-contained and clean. The save panel variable is a local var in the method that kicks off the

Re: Telling apart different save panels

2011-09-20 Thread Scott Ribe
On Sep 20, 2011, at 4:15 PM, Graham Cox wrote: In my app I have two places where a NSSavePanel is used to set up different sorts of file save. I think I'd use two different completion blocks... -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice

Re: Telling apart different save panels

2011-09-20 Thread Graham Cox
On 21/09/2011, at 8:27 AM, Scott Ribe wrote: I think I'd use two different completion blocks... I am already. It doesn't solve the problem. It's not the completion blocks that need to distinguish the panels (well, they do, and they do…), it's the panel's delegate. --Graham

Re: Telling apart different save panels

2011-09-20 Thread Kyle Sluder
On Tue, Sep 20, 2011 at 3:15 PM, Graham Cox graham@bigpond.com wrote: I could of course assign the save panels to an ivar of the delegate so that it can perform a comparison, but that strikes me as pretty messy, given that otherwise the panels are very neatly encapsulated along with their

Re: Telling apart different save panels

2011-09-20 Thread Graham Cox
OK, I've done it this way and it seems to be quite a nice solution - thanks! In terms of memory management, I'm releasing the helper object (panel delegate) in the completion block. While that apparently works without a problem, I'm wondering if that's truly safe and reliable - I'm still fairly

Re: Telling apart different save panels

2011-09-20 Thread Andy Lee
I guess I didn't understand the original problem. I thought the id of the save panel wasn't useful because it's local variable. It sounded like it's not so much the save panel you want to distinguish, but the context in which the save panel is being used. I was going to suggest making

Re: Telling apart different save panels

2011-09-20 Thread douglas welton
Graham, I'm not sure that my solution is any less messy than what you have suggested, but... when faced with this same situation, I gave the save panel a different title each time it was invoked. When the panel object was passed to my delegate, I could tell where the panel was being used by

Re: Telling apart different save panels

2011-09-20 Thread Scott Ribe
On Sep 20, 2011, at 4:43 PM, Graham Cox wrote: I am already. It doesn't solve the problem. It's not the completion blocks that need to distinguish the panels (well, they do, and they do…), it's the panel's delegate. Ah, I was thinking that the completion blocks were calling into the

Re: Telling apart different save panels

2011-09-20 Thread Graham Cox
On 21/09/2011, at 8:54 AM, Scott Ribe wrote: Ah, I was thinking that the completion blocks were calling into the delegate, and that you needed to distinguish between panels there. So you're trying to distinguish earlier? Yes, specifically, in the delegate method: panel:validateURL:error: