Re: NSTableView ignores changes to cell's objectValue outside mouse tracking methods?
Re: NSTableView ignores changes to cell's objectValue outside mouse tracking methods?
- Subject: Re: NSTableView ignores changes to cell's objectValue outside mouse tracking methods?
- From: Corbin Dunn <email@hidden>
- Date: Fri, 26 Feb 2010 13:20:08 -0800
On Feb 26, 2010, at 11:07 AM, Sean McBride wrote:
> Hi all,
>
> So for some days now I've been trying to make a custom NSActionCell that
> works in an NSTableView that in turn uses Cocoa Bindings.
>
> Starting from mmalc's ClockControl example, I now have it working for
> simple cases.
>
> Basically, I'm trying to implement a cell version of NSColorWell.
>
> This works:
>
> - (BOOL)startTrackingAt:(NSPoint)startPoint
> inView:(NSView *)controlView
> {
> NSColor* colour = create random colour
> [self setObjectValue:colour];
> }
>
> This doesn't:
>
> - (BOOL)startTrackingAt:(NSPoint)startPoint
> inView:(NSView *)controlView
> {
> NSColor* colour = create random colour
> [self performSelector:@selector(setObjectValue:)
> withObject:colour
> afterDelay:0.0
> }
>
> There seems to be something 'special' about the various mouse tracking
> methods. It seems that if I change my cell's objectValue outside of the
> mouse tracking methods, that the TableView does not pay attention (and
> does not update my model).
>
> I want to change my cell's objectValue in response to an action from the
> NSColorPicker.
>
> Is there a way to 'poke' the tableview so that it notices such a change?
Take a look at the "AnimatedTableView" demo app. I added a custom color well cell type of thing, and demonstrate how to update values outside the normal click+tracking way of doing things. Last years WWDC talk covered this too (I think you can buy it on iTunes).
corbin
_______________________________________________
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