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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to