• 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: is there a way to determine if an NSButton is toggleable ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is there a way to determine if an NSButton is toggleable ?


  • Subject: Re: is there a way to determine if an NSButton is toggleable ?
  • From: Uli Kusterer <email@hidden>
  • Date: Thu, 23 Aug 2018 05:03:26 +0200


> On 20. Aug 2018, at 12:04, Guillaume Laurent <email@hidden>
> wrote:
>
> Hi all,
>
>
> For a custom UI I’ve had to write a custom control deriving from NSButton,
> which highlights itself in a special way on mouse-over. In the method which
> does the highlighting, I check if the button’s state is either .on or .off,
> so I know which title or alternateTitle to display. But I realized that, no
> matter the button's type, the state is always toggled on click. That is, even
> if the button’s type is set to MomentaryPushIn, the button’s state is toggled
> after a click. I’d have thought that this was the case only for
> OnOff/Toggle/Switch… types.
>
> Since there is no NSButton.type getter, is there a way to determine if the
> button’s type is toggleable or not ? And what is the reason for switching
> state for types like MomentaryPushIn ?

 You want to look at the showsStateBy bit field. See:

http://orangejuiceliberationfront.com/building-a-custom-nsbutton/

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >is there a way to determine if an NSButton is toggleable ? (From: Guillaume Laurent <email@hidden>)

  • Prev by Date: Re: Carbon -> Cocoa
  • Next by Date: Re: Carbon -> Cocoa
  • Previous by thread: Re: is there a way to determine if an NSButton is toggleable ?
  • Next by thread: Custom keyboard with search bar not behaving
  • Index(es):
    • Date
    • Thread