Re: How to set a mixed checkbox?
Re: How to set a mixed checkbox?
In my NSOutlineView, I have a series of checkboxes ( [buttonCell
setButtonType: NSSwitchButton], where "buttonCell" is an
NSButtonCell), however, I can't seem to set a mixed state. In my
- (id)outlineView:(NSOutlineView *)olv objectValueForTableColumn:
(NSTableColumn *)tableColumn byItem:(id)item
I do a:
objectValue = [NSNumber numberWithInt: [node mRunState]];
If I return a 0, the checkbox turns off, a 1 on. However, if I
return a -1 (NSMixedState), the checkbox stays on (instead of the
horizontal bar "mixed" state).
How do I set a mixed state?
Thanks!
This may be a dumb question, but did you call -
setAllowsMixedState:YES on your buttonCells when setting them up?
I tried this out, and it mostly works the way I want. I have a
hierarchy of checkboxes, so if one "upstream" is deselected, I want
all the checkboxes downstream deselected; if (at least) one (but not
all) of the downstream checkboxes are checked, then all the upstream
checkboxes need to be set to a mixed state. This is all working.
What is also happening is that when the user clicks on a checkboxes,
Cocoa cycles through the on/off/mixed state. I don't want that--the
user should only be able to turn on/off, with the app the only one
setting the mixed state.
Should I change the value sent by setObjectValueForTableColumn from a
mixed state to the next state (I think it's ON)? Only user clicks
get sent this way (as I change my states, and then reload), so it
would make sense to do that here. I just don't know if depending on
the order of what follows after mixed state is assured…
Thanks!
Mark _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden