TableView still has selected items after deletion
TableView still has selected items after deletion
- Subject: TableView still has selected items after deletion
- From: "Peter.Teeson" <email@hidden>
- Date: Tue, 30 Mar 2004 21:41:46 -0500
I have a TableView that permits multiple selections.
I put up a sheet asking for confirmation of the deletions and if the
user presses the OK button the
deletions are done correctly, even with discontiguous selections.
(As a point in passing I of course delete them from the bottom to the
top so as to not change the row indexing)
In my deleteAlertDidEnd: method I make sure to call my updateUI method
which includes a reload of the tableView.
But I only call it after the loop that deletes all of the selected
records has exited.
The problem is that not all of the selections are un-highlighted, even
though the originally selected rows are correctly deleted.
It leaves the impression that there are still rows to delete bcause
there are a couple of rows still selected.
There is a routine deleteAll which is a target/action method and seems
to require the delegate to implement method returning Yes or No. But
why is this needed?
Or have I missed something simple? I was expecting that the deleted
rows would also lose the selection highlighting at the same time as the
deletion.
respect....
Peter
here is the code:
- (void)deleteAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode
contextInfo:(void *)contextInfo {
if (returnCode == NSAlertSecondButtonReturn) return; // User said
cancel
// loop through selected rows, from last to first, deleting them
NSIndexSet *selectedRows = [[NSIndexSet alloc] init];
selectedRows = [tableView selectedRowIndexes];
unsigned int theRow = [selectedRows lastIndex];
while (theRow != NSNotFound) {
[self deleteRecord:theRow];
theRow =[selectedRows indexLessThanIndex:theRow];
}
[self updateUI];
}
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.