• 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
Re: button cell - selection change timing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: button cell - selection change timing


  • Subject: Re: button cell - selection change timing
  • From: Rainer Standke <email@hidden>
  • Date: Sun, 27 Dec 2009 18:21:01 -0800

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);


Thanks again,

Rainer

On Dec 27, 2009, at 18:10 , Paul Bruneau wrote:

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

Hello all,

I have a table view with a column that holds a button cell. When the user clicks the button I need to open a web browser with an URL that is stored in the object represented by the table view's row. All of this is in a Core Data app.

When the button is clicked in a row that is already selected everything works as expected.

When the user clicks a button in a row that is currently not selected, then I get the URL for the row that's in the process of being de-selected, because the method targeted by the button runs before the selection has changed to the new row.

What can I do about this?

Can we see the code in the method targeted by the button? It is good to show some code when asking for help.


Although it might not be necessary--I suspect you are using - selectedRow instead of -clickedRow to get the row the user clicked. Try -clickedRow.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: button cell - selection change timing
      • From: Paul Bruneau <email@hidden>
References: 
 >button cell - selection change timing (From: Rainer Standke <email@hidden>)
 >Re: button cell - selection change timing (From: Paul Bruneau <email@hidden>)

  • Prev by Date: Re: Can you get data from the software update PP?
  • Next by Date: Re: button cell - selection change timing
  • Previous by thread: Re: button cell - selection change timing
  • Next by thread: Re: button cell - selection change timing
  • Index(es):
    • Date
    • Thread