Re: Is there an easier way of changing NSButtonCell state in an NSOutlineView
Re: Is there an easier way of changing NSButtonCell state in an NSOutlineView
- Subject: Re: Is there an easier way of changing NSButtonCell state in an NSOutlineView
- From: Gilles Celli <email@hidden>
- Date: Thu, 24 Nov 2011 14:46:37 +0100
My hierearchical list will not changed or sorted in the NSoutlineView….that's why I was thinking to use NSArray for the buttons.
However if I want to do it correctly, should I add an ivar like BOOL isChecked to my OvItem class ? So I won't need an NSArray
Like this:
@interface OvItem : NSObject {
NSString *name;
NSMutableArray *children;
BOOL isGroup;
BOOL isChecked; // For NSButtonCell in the NSOutlineView
}
Do you think this is a better idea than using NSArray ?
-gilles
On Nov 23, 2011, at 10:39 PM, Quincey Morris wrote:
> On Nov 23, 2011, at 12:40 , Gilles Celli wrote:
>
>> things are a little more clear now, so I will stick with the NSArray version.
>
> Actually, I gave you a partially wrong answer. I noticed you are using a NSOutlineView, but then I forgot to take into account the list hierarchy. In general, trying to back a hierarchical list with a flat array isn't going to work too well. The only time it really works is if the list never changes, in which case the correlation between row number and item is fixed.
>
> For the general case, you're going to need either a hierarchical data model, or the ability in your data source methods to construct the hierarchy on the fly. Either is feasible. NSTreeNode is a useful class if you're creating a hierarchical data model.
>
>
>
>
_______________________________________________
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