NSGestureRecognizer for NSToolbarItem in Custom NSToolbar

NSToolbarItem is not a subclass of NSView, so it does not support the addGuestureRecognizer method. If its NSToolbar was not configured, you could get the exact NSToolbar subView by index, and then use the addGuestureRecognizer method. However, if the toolbar is customizable, the index can change, and the user can add and remove a button that requires quite a lot of code for this simple thing.

Is there any solution for this?

+6
source share

Source: https://habr.com/ru/post/1016709/


All Articles