tableViewSelectionDidChange not being called after selectionShouldChangeInTableView?
tableViewSelectionDidChange not being called after selectionShouldChangeInTableView?
- Subject: tableViewSelectionDidChange not being called after selectionShouldChangeInTableView?
- From: Josh Burnett <email@hidden>
- Date: Wed, 19 Oct 2005 15:55:04 -0400
Hi all,
I'm working on an application that has a table where each row
corresponds to an object, and a drawer that has the selected object's
info laid out in more detail. Rather than having the values directly
bound through an NSArrayController, I would rather have the changes
wait until the user explicitly clicks a button. That part I've got so
far.
If the user begins editing on object's details, and then goes to switch
to a different object without saving or canceling the edits in
progress, I want an alert dialog to pop up and ask it the user wants to
record the changes, discard them, or continue editing the object. At
the moment, I've got this implemented through the table's
selectionShouldChangeInTableView: delegate method. Without the alert,
everything behaves as expected.
Here's snag #1: when selectionShouldChangeInTableView: returns NO, the
table in question issues its action, acting as if the original row had
been re-selected, rather than no change in selection having occurred.
This throws everything off, because it resets the edited detail fields
to the objects currently saved values, not their potentially edited
states.
First, is there a way to make this not happen? It would make my life
easier if the table just acted like nothing had happened. Then I
wouldn't have to worry about the next problem.
As an attempted workaround, I disassociated the table from its action
and called it in the tableViewSelectionDidChange delegate method. This
seemed alright, until I put the aforementioned alert in the
selectionShouldChangeInTableView: delegate method. Without the alert,
if shouldChange returns YES, the didChange method gets called. With
the alert, the didChange method does not get called, even if the
shouldChange method returns YES. This makes no sense to me.
What's going on here? Any suggestions or ideas? I can post the code
if anyone wants to see it, as it's not that long.
Thanks a lot,
Josh
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden