FROM : Tom Burns
DATE : Tue Jul 18 18:58:03 2006
Ah, I wasn't aware that the ArrayController's current selection
reflected the current selection of the NSTableView. If it really does,
this simplifies things quite a bit.
Tom
On 7/18/06, Andreas Mayer <<email_removed>> wrote:
>
> Am 18.07.2006 um 18:21 Uhr schrieb Tom Burns:
>
> > I am not sure how to go about
> > "getting" the managed object associated with the selected row in the
> > tableview.
>
> You ask the associated array controller for it's current selection:
>
> id firstSelectedObject = [[myArrayController selectedObjects]
> objectAtIndex:0];
>
>
> Also, you'll probably want to add an observer, to be notified when
> the selection changes:
>
> [myArrayController addObserver:self forKeyPath:@"selection"
> options:NSKeyValueObservingOptionNew context:NULL];
>
>
> And don't forget to remove the observer, before you destroy it.
>
>
>
> Andreas
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
DATE : Tue Jul 18 18:58:03 2006
Ah, I wasn't aware that the ArrayController's current selection
reflected the current selection of the NSTableView. If it really does,
this simplifies things quite a bit.
Tom
On 7/18/06, Andreas Mayer <<email_removed>> wrote:
>
> Am 18.07.2006 um 18:21 Uhr schrieb Tom Burns:
>
> > I am not sure how to go about
> > "getting" the managed object associated with the selected row in the
> > tableview.
>
> You ask the associated array controller for it's current selection:
>
> id firstSelectedObject = [[myArrayController selectedObjects]
> objectAtIndex:0];
>
>
> Also, you'll probably want to add an observer, to be notified when
> the selection changes:
>
> [myArrayController addObserver:self forKeyPath:@"selection"
> options:NSKeyValueObservingOptionNew context:NULL];
>
>
> And don't forget to remove the observer, before you destroy it.
>
>
>
> Andreas
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Tom Burns | Jul 18, 18:09 | |
| Jim Correia | Jul 18, 18:14 | |
| Tom Burns | Jul 18, 18:21 | |
| Jim Correia | Jul 18, 18:46 | |
| Andreas Mayer | Jul 18, 18:50 | |
| Tom Burns | Jul 18, 18:58 |






Cocoa mail archive

