Re: OutlineView shouldSelectItem Being Called Twice
Re: OutlineView shouldSelectItem Being Called Twice
- Subject: Re: OutlineView shouldSelectItem Being Called Twice
- From: Graham Cox <email@hidden>
- Date: Thu, 06 Jun 2013 09:15:00 +1000
On 06/06/2013, at 5:01 AM, Chris Tracewell <email@hidden> wrote:
> Thanks for the reply. This OV is acting as a master for a detail view that must be saved before the selection changes if it's dirty. Is there another method to intercept the OV row click before selection actually changes wherein I can validate and present an NSAlert for save,cancel,discard options if need be?
From a usability perspective, this doesn't sound like a very friendly design. If I click a row and (by some means) get a barrage of "Save Changes?" alerts I'm going to become pretty wary of exploring your interface.
Instead, why not just track the dirty state for each 'detail' and save them all in one go at some more appropriate time, such as when the window is dismissed, or when the user clicks a 'Save' button, or just quietly save them to a temporary file... I don't know what is most appropriate for your app but anything that doesn't interrupt the UI 'flow' would most likely be better than the current approach.
That said, your controller could refuse the selection change if the dirty state is detected, but not to directly present an alert. Instead, it could ask itself to perform a selector after a delay (which can be 0), and knowing that it might get called more than once, be prepared to cancel a previous request before sending a new one so that the alert only shows up once.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden