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?
Asked
Active
Viewed 419 times
3
-
Please read the documentation of [NSView](https://developer.apple.com/documentation/appkit/nsview) – especially the *Subclassing Notes* – which `NSBox` is a subclass of. – vadian Sep 28 '18 at 18:18
2 Answers
2
As a subclass of NSView
, NSBox
responds to the mouseDown
event. More information at https://developer.apple.com/documentation/appkit/nsresponder/1524634-mousedown

Gabriel Roth
- 1,030
- 1
- 12
- 31
1
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)...

AglaiaZ
- 31
- 6