0

I work on a custom OS-X Cocoa menu bar app. I put a custom NSView as subview on the NSStatusItem's button. It looks ok, however when selecting the button the blue highlight has overlay issues:

enter image description here

I'm using NSColor.clear wherever possible - the only thing the custom NSView is presenting is a NSBezierPath (circle) and NSText (text) - both with transparent background. I might have a completely wrong approach, didn't know other way to put those custom views there.

So my question is if it's possible to show a full button selection overlay (blue highlight) on mouse click or this is a wrong concept (to use custom views on NSButton)?

itarato
  • 795
  • 1
  • 8
  • 24

1 Answers1

0

If you are creating a button programmatically, set its type to momentaryChange. Or you can do it with the interface builder.

btn.setButtonType(.momentaryChange)
El Tomato
  • 6,479
  • 6
  • 46
  • 75
  • It's the standard existing button on the NSStatusItem: https://developer.apple.com/documentation/appkit/nsstatusitem/1535056-button - in any case, I've tried. Changed the type to .momentaryChange (tried others too) but no change unfortunately. – itarato Jun 17 '17 at 00:31
  • Have you set 'isBordered' to false? – El Tomato Jun 17 '17 at 00:46