Re: ButtonCell with Text in OutlineView
Re: ButtonCell with Text in OutlineView
- Subject: Re: ButtonCell with Text in OutlineView
- From: David <email@hidden>
- Date: Fri, 16 May 2008 16:32:30 -0400
Is there a document which describes how columns interact with enclosed cells
when dealing with bindings?
There's a message flow going on that I'm not aware of. setObjectValue is
passed different things for the same binding depending on if my class
subclasses NSTextFieldCell or NSButtonCell. I don't see a way to fake it out
without seeing more of the message flow. Too bad the source code isn't
available. In the Java world, if worse comes to worse you can read the
source to understand how framework classes interact.
I've also read about a delegate method on
NSOutlineView, outlineView:willDisplayCell:forTableColumn:item:
Is this a more appropriate way to solve the problem? Should I be able to
modify the title of a button cell through this delegate method?
On Fri, May 16, 2008 at 1:58 AM, Kyle Sluder <
email@hidden <email@hidden>> wrote:
> On Thu, May 15, 2008 at 1:39 PM, David <email@hidden> wrote:
> > I do not understand how the column in the NSOutlineView knows how to set
> the
> > property to the cell. How are the cell and column related? How do they
> > interact?
>
> You bind the value of the column to a property, and then the column
> loops N times, where N is the number of rows, setting the cell's value
> and then drawing the cell in each row. It's non-obvious until you
> really understand how the view/cell dichotomy works.
>
> > Is this the best approach? Is there some other preferred approach to this
> > common problem?
>
> I'm hesitant to suggest this because it seems like bad form (reminds
> me of the magic \t character in Windows menus that separates the menu
> item name from its accelerator key) but you could probably use a
> custom cell and override its -setObjectValue: method to parse your
> string and then call -setTitle: as appropriate.
>
> --Kyle Sluder
>
_______________________________________________
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