ADC Home > Reference Library > Technical Q&As > Cocoa > Tools >
|
Q: I'm trying to add NSToolbars to my Cocoa application. I'm supposed to hook up my "Hide Toolbar" and "Customize Toolbar..." menu items to the First Responder's -toggleToolbarShown: and -runToolbarCustomizationPalette: actions, respectively, but I don't see those actions in Interface Builder! How do I wire them up? A: Those two actions are indeed implemented by NSWindow (and they are already in NSWindow.h), but Interface Builder doesn't list them by default (a bug). They handle some of the processing of the window's toolbar for you, so you don't have to write it yourself. You need to manually add them to the First Responder in Interface Builder, the same way you would add actions to your own custom classes (select First Responder in the Classes tab, choose "Add Action" from the Classes menu, and enter the action's name, for example). Then you can wire up your menu items to those actions.
[May 03 2001] |
|