Re: NSIndexSet of NSButtonCells in NSOutlineView
Re: NSIndexSet of NSButtonCells in NSOutlineView
- Subject: Re: NSIndexSet of NSButtonCells in NSOutlineView
- From: Gilles Celli <email@hidden>
- Date: Thu, 08 Dec 2011 22:22:25 +0100
Ok as you suggested it's better to call it active Buttons in the OutlineView then selected...
For the NSIndexSet: let's say that I've 3 ore more NSButtonCells, if only one is active then it will display only one Graph, if it has 2 activated let's say the first and last one both resp. graphs will be displayed and so on.
For example NSTableView / NSOutlineView method (NSIndexSet *)selectedRowIndexes is useful if a user selects / unselects multiple rows.
However in my case I've a bunch of NSButtonCells which can be activated / deactivated without selecting / deselecting the outlineview multiple rows...the difference is that to have the multiple rows activated a user
must press the SHIFT key... with a bunch of NSButtonCells this is not necessary.
So the question is: how do I detect which set if NSButtonCells are active ?
I hope that my explanation are a little bit more clear now ...
Gilles
On 8 déc. 2011, at 19:13, Quincey Morris wrote:
> On Dec 8, 2011, at 08:12 , Gilles Celli wrote:
>
>> The instrument's name is selectable as an NSButtonCell, the idea is to turn on/off its respective graph / plot.
>> So there's a mix of NSButtonCells along with NSString in the NSOutlineView.
>> My model's NSButtonCells are based of NSMutableDictionary which will change the integerValue of NSButton for their resp. key, this works.
>>
>> I've setup an NSArray to store the selected instruments.
>> In fact I've problems creating the NSIndexSet of the selected instruments and not knowing where to put the whole code.
>
> Your question is unclear. Because we're talking about a NSOutlineView, "selected" means what you're calling "highlighted" below. It's better not to use "selected" to refer to the on/off state of your button cells. Let's call that "active".
>
>> Should I put the code in
>> In outlineView: objectValueForTableColumn:byItem:(id)item or in
>> outlineView:setObjectValue:forTableColumn:byItem: ?
>
> If you're trying to maintain a NSArray of "active" instruments, the correct place would be outlineView:setObjectValue:forTableColumn:byItem:, since that's the point at which you get told of the change of state.
>
>> Putting it in the NSOutlineView notification method -(void)outlineViewSelectionDidChange:(NSNotification *)notification is bad idea (I think) since then
>> the NSButtons are only changing their state if the row of the NSOutlineView is highlighted / selected.
>>
>> I want to have the user change the state of the buttons whithout first selecting the row of the outlineview.
>>
>> So should I alway recreate a new NSIndexSet for the selected NSButtonCells ? If yes in which method should I put the code ?
>
> I'm not sure what the NSIndexSet is for. Do you mean "selected" or "active"?
>
_______________________________________________
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