I have subclassed NSTableCellView
to do some custom drawing. When the containing NSOutlineView
's highlight style is set to None my view receives mouseDown events.
When I change the NSOutlineView
's highlight style to Regular, my view no longer receives its mouseDown events.
How can I pass the mouseDown events to my view while keeping the outline view's highlight style to Regular?
Apparently NSTableView
overrides -hitTest:
in order to implement the row selection/dragging/etc. functionality - that would explain why you're having no issues when the highlighting style is None.
As per the Apple Docs:
Specifying How Subviews Should Respond to Events
[...] If you create a table view subclass, you can override validateProposedFirstResponder:forEvent: to specify which views can become the first responder. In this way, you receive mouse events.
Or optionally.. if event handling is vital to your subclass: Why not create a NSControl
subclass?
As per the same docs there's special handling for controls already implemented in the stock table view class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With