• 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: Custom NSButton image effects for pressed/disabled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSButton image effects for pressed/disabled


  • Subject: Re: Custom NSButton image effects for pressed/disabled
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 12 Dec 2018 16:46:54 -0800


> On Dec 11, 2018, at 5:03 PM, Lars C. Hassing <email@hidden> wrote:
>
> If I assign an image to an NSButton it is displayed with nice pressed and
> disabled effects.
>
> In my custom NSButton, that should display image1+title+image2, I override
> drawRect:, but how do I obtain the EXACT SAME system effects for the two
> images?

Don’t override drawRect; you should use a custom NSButtonCell instead. (In
general NSButton is just a wrapper around NSButtonCell.)

That itself may solve your problem. If not, you could work around it by
creating a single NSImage (at runtime) with the two images and the title in it,
and just setting that as the button’s image.

—Jens

_______________________________________________

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

  • Follow-Ups:
    • Re: Custom NSButton image effects for pressed/disabled
      • From: "Lars C. Hassing" <email@hidden>
References: 
 >Custom NSButton image effects for pressed/disabled (From: "Lars C. Hassing" <email@hidden>)

  • Prev by Date: Re: Custom NSButton image effects for pressed/disabled
  • Next by Date: Re: Custom NSButton image effects for pressed/disabled
  • Previous by thread: Re: Custom NSButton image effects for pressed/disabled
  • Next by thread: Re: Custom NSButton image effects for pressed/disabled
  • Index(es):
    • Date
    • Thread