• 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 do I distinguish between radio and switch buttons?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I distinguish between radio and switch buttons?


  • Subject: Re: How do I distinguish between radio and switch buttons?
  • From: Michael Watson <email@hidden>
  • Date: Thu, 7 Dec 2006 16:23:48 -0500

Have you considered a simple subclass that just adds an instance variable you can use to track it yourself? (Roll your own - buttonType, essentially.)

The thought occurs to me, however, that requiring such a solution suggests that your need is somehow flawed.


--------------------------------

int _buttonType;

- (void)setButtonType:(NSButtonType)aType
{
	_buttonType = aType;
	[super setButtonType:aType];
}

- (int)buttonType
{
	return _buttonType;
}

--------------------------------


On 07 Dec, 2006, at 13:43, Alan Smith wrote:

Hi everyone,

I want to know if a given NSButtonCell is a radio or switch button.
I've looked around a lot but can't figure out how to do this. There is
no - (NSButtonType)buttonType method for NSButton(Cell) which would do
the trick, if it existed.

Both the NSRadioButton and NSSwitchButton return 1 for highlightsBy
and showsStateBy so this does not help to differenciate between the
two. However, that does set them apart from the other button types so
I'm about half way there.

Thanks in advance, Alan.

PS. The method will have to work with "archived" buttons from nibs.
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unnecessary, then it
shall evolve."
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40bungie.org


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >How do I distinguish between radio and switch buttons? (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: Quick NSTableView question...
  • Next by Date: Re: Quick NSTableView question...
  • Previous by thread: How do I distinguish between radio and switch buttons?
  • Next by thread: Re: How do I distinguish between radio and switch buttons?
  • Index(es):
    • Date
    • Thread