• 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
doubleClick and tableView Trouble
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

doubleClick and tableView Trouble


  • Subject: doubleClick and tableView Trouble
  • From: "Charles Moore Jr." <email@hidden>
  • Date: Wed, 1 Feb 2006 15:04:08 -0600

i'm having an odd problem with double-clicking within a tableView.

i have an NSTableView bound to an NSMutableArray full of objects. i currently have doubleClick performing the following when called:

Object *myObject=[myObjectArray objectAtIndex:[myTableView clickedRow]];

i then send myObject to another module via a notification like this:

NSDictionary *d=[NSDictionary dictionaryWithObject:myObject forKey:@"objectSelected"];
NSNotification *n=[NSNotification notificationWithName:@"objectWasSelected" object:self userInfo:d];
[[NSNotificationCenter defaultCenter] postNotification:n];


the second module then does something brilliant with the selected object.

this all works beautifully.

however, if i then SORT the table-view, things break down.


if i have three objects 'A', 'B', and 'C' at row indices 0,1, and 2 respectively - doubleClicking on A correctly selects A.


however, if i then sort the tableView so that now the objects are presented as 'C', 'B', and 'A', double-clicking on 'A' pulls up object 'C'. selecting 'A' pulls up 'C'. it appears that, while the tableview is successfully re-sorting how the objects appear, the underlying bound array still thinks they are in the previous order.

i've worked around this so far by simply disabling sorting but i would like to find out what i'm doing wrong.

thanks...

cm


---------------------------------- Charles Moore email@hidden


_______________________________________________ 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
  • Follow-Ups:
    • Re: doubleClick and tableView Trouble
      • From: Glenn Zelniker <email@hidden>
  • Prev by Date: Re: Learning Cocoa, but no programing experience, possible?
  • Next by Date: Re: Learning Cocoa, but no programing experience, possible?
  • Previous by thread: Re: NSTableView drag and drop - re-target drop to entire table?
  • Next by thread: Re: doubleClick and tableView Trouble
  • Index(es):
    • Date
    • Thread