Re: Standard NSToolbarItems
Re: Standard NSToolbarItems
- Subject: Re: Standard NSToolbarItems
- From: Chuck Pisula <email@hidden>
- Date: Fri, 30 Nov 2001 10:21:43 -0800
I'm having a small problem constructing a toolbar for an application
I'm working on. The toolbar items that I create work perfectly, but I'd
also like to use a couple of Apple's predefined standard toolbar items.
If I just do something like the following, the item itself works and
displays correctly in the toolbar, but it shows up as a completely
blank object in the customization sheet(no name, no image, but can
still be dragged to the toolbar):
[tDict setObject:[[NSToolbarItem alloc]
initWithItemIdentifier:NSToolbarFlexibleSpaceItemIdentifier]
forKey:@"Flexible Space Item"];
where the delegate methods allow the toolbar to get items from tDict.
Any ideas?
First, you never have to actually allocate the standard items yourself.
NSToolbar takes care of that transparently for you. So, if you "allow"
NSToolbarFlexibleSpaceItemIdentifier in your implementation of
-toolbarAllowedItemIdentifier:, then NSToolbar will provide the item for
you as needed, meaning you never have to return standard items to your
toolbar, it will make them itself.
Next, I don't think creating a standard item via [[.. alloc]
initWithIdentifier:TheStandarItemIdentifer], works. I don't know if it
should. Feel free to log a bug with Apple if you think this should work.
Hope this helps,
-chuck