• 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: NSButton (Switch)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButton (Switch)


  • Subject: Re: NSButton (Switch)
  • From: Scott Anguish <email@hidden>
  • Date: Thu, 16 Aug 2001 02:56:36 -0400

On Friday, August 17, 2001, at 02:35 AM, stuartbryson wrote:
I have implemented a NSButton from within IB. It is a Switch or Checkbox. Accessing it via an oultet in my controller, I don't know how to test if it is Checked or Ticked. I tried intValue and also state from NSButton but neither work, they all return 0 regardless of what I beleive is its state.


to set it to a specific value (yes, no)


[activateCheckBox setIntValue:1]; (checked)

to get the value, use intValue

are you sure that you have it set up as a checkbox?

This is what I have in one of my action targets (when you click on the checkbox, it calls this.. it just sets a default)

- (void)activateChanged:(id)sender;
{
[[NSUserDefaults standardUserDefaults] setBool:([sender intValue] == 1) forKey:@"ActivateOnDragAndDrop"];
}

do you have the item in IB hooked up to a variable (an outlet?)


  • Follow-Ups:
    • Re: NSButton (Switch)
      • From: Ondra Cada <email@hidden>
References: 
 >NSButton (Switch) (From: stuartbryson <email@hidden>)

  • Prev by Date: Re: Coloring NSButtonCells
  • Next by Date: Re: Window resizing make weird things happen
  • Previous by thread: NSButton (Switch)
  • Next by thread: Re: NSButton (Switch)
  • Index(es):
    • Date
    • Thread