• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to set a mixed checkbox?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set a mixed checkbox?


  • Subject: Re: How to set a mixed checkbox?
  • From: "email@hidden" <email@hidden>
  • Date: Sat, 10 Jun 2006 18:33:28 -0700

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


  • Follow-Ups:
    • Re: How to set a mixed checkbox?
      • From: John Pannell <email@hidden>
References: 
 >How to set a mixed checkbox? (From: "email@hidden" <email@hidden>)
 >Re: How to set a mixed checkbox? (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: How to set a mixed checkbox?
  • Next by Date: NSTextView and horizontal scroller?
  • Previous by thread: Re: How to set a mixed checkbox?
  • Next by thread: Re: How to set a mixed checkbox?
  • Index(es):
    • Date
    • Thread