1
votes

When i use the following to create a button

NSWindow.standardWindowButton(NSWindowButton.ZoomButton, forStyleMask: 0)

I get a button that doesn't react to mouse hover events. I can augment this by creating a container view with a NSTrackingArea and manually triggering the highlight method but it produces a clicked state.

enter image description here

Is there a way to somehow force the button into the expected behavior state without the darkened background?

I have been trying to avoid subclassing NSButton, but it seems like i may have to, and I'm just in a state of denial.

1
Could you provide more code? What are you trying to achieve with this button? Are you trying to use different button then default? You can subclass nswindow to get custom behaviour: stackoverflow.com/questions/32027544/…Marek H
I want no titlebar and the ability to reposition the button set. Also when a titlebar is present the window forces rounded corners.Chad Scira
One question only, whats the code that plays with the button. Have you seen inappstorewindow? It can save you a lot of trouble. github.com/indragiek/INAppStoreWindowMarek H
For some reason i didn't want to use images ;XChad Scira

1 Answers

1
votes

I could not get this working for the life of me so my solution was to write my own custom buttons. This works fine for me because my NSWindow is already custom so there wont be a clash of style.

https://gist.github.com/icodeforlove/a334884e59784b4c2567

Another viable solution is to use https://github.com/indragiek/INAppStoreWindow as @xhruso00 mentioned, but it seemed like overkill.