On Dec 27, 2009, at 9:21 PM, Rainer Standke wrote:

> Sure. Here is what happens in the method targeted by the button. From the 
> tableview ( = sender) it gets the first column, from that it gets the array 
> controller behind the column, from that it gets the selection and finally it 
> gets the string I am after. All of this is in a core data app, and I am not 
> using a data source per se. The problem seems to be the timing of it all, 
> rather than how the method works, because when the selection doesn't change 
> in the button click, everything is fine.
> 
>       //get 1st column in sender:
>       NSTableColumn *tableColumn = [[sender tableColumns] objectAtIndex:0];
>       // get bound-to array controller
>       NSArrayController *arrayController = [[tableColumn 
> infoForBinding:@"value"]                     valueForKey:@"NSObservedObject"];
>       // get selected object's URL:
>       NSString *selectedPersonPage = [[arrayController selection] 
> valueForKey:@"URLFragment"];
>       NSLog(@"selectedPersonPage: %@", selectedPersonPage);

I must admit some ignorance of core data apps, but maybe that won't matter 
much. From what you said, sender is the tableview, so that is the same thing I 
would expect in a non-core-data app that I have more experience with.

You concern me with this statement of yours:

> The problem seems to be the timing of it all, rather than how the method 
> works, because when the selection doesn't change in the button click, 
> everything is fine.

It's not that everything is fine. It's that in your test case (where the 
selected row equals the clicked row), the thing that you are looking at (the 
selected row) just happens to be the same as what you want (the clicked row). 

So if you will accept that what you want is the clicked row, and you don't 
really care about the selected row(s), see what happens if you use [sender 
clickedRow] to get the clicked row, then from there to get your URL. Maybe 
-clickedColumn can help you too (your code has lost me a bit so I can't say for 
sure)

Hopefully my ignorance of core data isn't wasting your time. If it wasn't a 
holiday weekend (or even week) here in the states, I'd probably lurk this one 
out._______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to