• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Standard NSToolbarItems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Standard NSToolbarItems (From: Andre Lipinski <email@hidden>)

  • Prev by Date: create text that's dragable.
  • Next by Date: Ruby bindings for Cocoa
  • Previous by thread: Re: Standard NSToolbarItems
  • Next by thread: Re: Responder chain design
  • Index(es):
    • Date
    • Thread