One more NSToolbar question
One more NSToolbar question
- Subject: One more NSToolbar question
- From: Matt Ridley <email@hidden>
- Date: Wed, 9 May 2001 02:19:35 +0100
Hi folks,
I've been reading the AppKit release notes; specifically the
section on NSToolbar; and I saw the following text:
A couple of methods have been added to NSWindow to help support
NSToolbar. NSWindow now lets you add a toolbar, show/hide the
current toolbar, and run the customization palette. If you add
menu items in your application and hook them up to
toggleToolbarShown:, and runToolbarCustomizationPalette:
NSWindow will take care of validation. In particular, the menu
item with toggleToolbarShown: as its action will properly title
the menu item dependent on the current state of the toolbar.
This is all true enough (I see it in NSWindow.h), but those
actions aren't listed in Interface Builder when I control-drag
from my "Hide/Show Toolbar" menu item to my window. Thus, I'm
unclear as to how to specify toggleToolbarShown: as the action
for my menu item.
Currently, I have a ToolbarController class which takes care of
all processing related to my NSToolbar. It has two custom
actions, one of which is showHideToolbar:. In my implementation
for showHideToolbar:, I simply do this:
[toolbarWindow toggleToolbarShown:sender];
This has the desired effect of hiding/showing the toolbar in the
endorsed way (highlighting the toolbar widget at the right of
the titlebar as it does so), but it does NOT automatically
change the title of my "Hide/Show Toolbar" menu item. I'm
presuming that if I could somehow directly specify
toggleToolbarShown: as the action for my menu item (in Interface
Builder), that it would then take charge of the title of my menu
item, and make it either "Hide Toolbar" or "Show Toolbar" as
appropriate. But, as I said, Interface Builder doesn't seem to
know about that action.
Any help would be much appreciated. It's a minor cosmetic
problem, but I'd like my menu item not to always just say
"Hide/Show Toolbar" - that's quite clumsy. Thanks once
again. :-)
Best,
-Matt
--
Matt Ridley
<
http://www.mattridley.com/>