I have a NSBox with some labels inside it, that I want to act as a button. Is this possible, or do I have to find some other way to make large areas of an application clickable?
Is it possible to make a NSBox clickable (like a NSButton) in Swift macOS?
458 views Asked by frankwolffnl At
2
There are 2 answers
0
On
As a subclass of NSView
, NSBox
responds to the mouseDown
event. More information at https://developer.apple.com/documentation/appkit/nsresponder/1524634-mousedown
Yes, use the func mouseDown event. You can also do this based on location. Also, if you’re working with the sks file you can always create a transparent button on top (assuming the box with labels is stationary)...