• 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 Bindings in an NSTableView (Pre 10.4)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DoubleClick and Bindings in an NSTableView (Pre 10.4)


  • Subject: DoubleClick and Bindings in an NSTableView (Pre 10.4)
  • From: Daniel Jalkut <email@hidden>
  • Date: Mon, 24 Oct 2005 13:36:03 -0400


I'm managing an NSTableView's content with an NSArrayController. Since the "doubleClickTarget" and "doubleClickArgument" bindings are not supported in 10.3, I have to use traditional target-action to support double-clicks in the table.


I've implemented and assigned a doubleAction method to the table, which works great. What I'm curious about is whether there's a better way than what I'm doing now to get at the "clicked item" from the bindings-managed table.

Right now I'm relying on the array controller's "arrangedObjects" method. I figure if the table gets its content from this method, then it should be reliable to assume that there's a 1-1 correspondence between it and the clickable rows:

id clickedItem = [[mTableController arrangedObjects] objectAtIndex:[sender clickedRow]];

Is this a reasonable assumption? Even if it is, I'm a bit uncomfortable with the double-dependency on the array controller. I would prefer to interrogate the table view for the "represented object" of the row that was just clicked. Barring that, could I programatically determine the content controller that was used to populate the array? I would like to be able to say something like this:

NSArrayController* tableController = [sender contentController];
id clickedItem = [[tableController arrangedObjects] objectAtIndex:[sender clickedRow]];


As a generic way of getting the represented object for any table view's double-click. Is this possible using the bindings API in 10.3? I see that 10.4 has a handy "infoForBinding" method which could help me do this, but am I out of luck on 10.3?

Any tips on how to best handle this situation is appreciated! Perhaps I'm overlooking something obvious.

Daniel
_______________________________________________
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


  • Prev by Date: Re: NSMenu menuBarHeight is 0?
  • Next by Date: motivated cocoa developer
  • Previous by thread: Re: NSMenu menuBarHeight is 0?
  • Next by thread: Re: DoubleClick and Bindings in an NSTableView (Pre 10.4)
  • Index(es):
    • Date
    • Thread