FirstResponder as delegate for NSToolBar

271 views Asked by At

I have a Mac app that consists of a window with a variable number of panes in it, each containing a tableview. The window has a toolbar with buttons, and I want the VC for the currently selected pane to handle validating the toolbar items, as well as being target for their actions.

If I could set first responder as delegate for the toolbar, this would be handled automatically, so my question is if that is possible! I have obviously googled around for this and some articles seem to hint that it is possible, but IB doesn't seem to let me do it.

1

There are 1 answers

2
Droppy On BEST ANSWER

An NSWindowController subclass would be better suited for this, that is the toolbar's delegate (it's natural role anyway) and can talk with the currently selected pane, using a custom protocol to decide on business logic.

Same goes for the UI/Menu action handlers; the window controller is perfect for this and your design will fit within it well.

It's not really got anything to do with the first responder as you are interested in the currently selected pane, not the first responder.