• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
TableView still has selected items after deletion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: Warnings during build resulting in disallowing further builds
  • Next by Date: Re: how do you use the SCM feature?
  • Previous by thread: Problems compiling C files and adding them to my main project
  • Next by thread: Trying to use MallocDebug
  • Index(es):
    • Date
    • Thread