tags:

views:

12

answers:

1

I'm working on a Mac app that uses a toolbar in it's main window. In the menu there is an item that allows the user to show or hide the toolbar. In Interface Builder this menu item is connected to the toggleToolbarShown: method of First Responder in my MainMenu.xib. FWIW, my main window is in a different xib and toggleToolbarShown: is correctly called on it when it is the frontmost window.

My app has a preferences panel that also has a toolbar. However, I don't want the user to be able to toggle the toolbar on this panel. As it stands, the show/hide menu item does allow toggling of the preference toolbar when the preference window is frontmost since it goes through First Responder.

How do I disable this behavior for just the preference panel, but not the main window?

+1  A: 

You can use an NSWindow subclass for your preferences window, and disable the menu item from there. See Camino's PreferencesWindow, which does exactly what you want to do. You'll also want to call setShowsToolbarButton:NO on the window, if you aren't already doing that.

smorgan