• 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
Using NSToolbar itemForItemIdentifier properly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using NSToolbar itemForItemIdentifier properly?


  • Subject: Using NSToolbar itemForItemIdentifier properly?
  • From: Pierre-Olivier Latour <email@hidden>
  • Date: Sat, 27 Jul 2002 16:18:54 +0200

Hi,

I'm in trouble with this delegate method for NSToolbar:

- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar
itemForItemIdentifier:(NSString *)itemIdentifier
willBeInsertedIntoToolbar:(BOOL)flag;


According the AppKit PDF doc:
Returns a toolbar item of the kind identified by the given toolbar
itemIdentifier. This is where
you create new toolbar item instances. This method is called lazily on
behalf of a toolbar
instance, which must be the sole owner of the toolbar item. A toolbar may
ask again for a kind
of toolbar item already supplied to it, in which case this method can and
should return the same
toolbar item it returned before.

According to the NSToolbar header doc:
/* Required method. Given an item identifier, this method returns an item.
Note that, it is expected that each toolbar receives its own distinct
copies. If the item has a custom view, that view should be in place when
the item is returned. Finally, do not assume the returned item is going to
be added as an active item in the toolbar. In fact, the toolbar may ask for
items here in order to construct the customization palette (it makes copies
of the returned items). if willBeInsertedIntoToolbar is YES, the returned
item will be inserted, and you can expect toolbarWillAddItem: is about to be
posted. */

So now what? I am supposed to return a new NSToolbar item each time (that's
what they do in the toolbar example in developer.apple.com/samplecode)
itemForItemIdentifier method is called, or return the same one all the time?


_____________________________________________________________

Pierre-Olivier Latour email@hidden
Lausanne, Switzerland http://www.pol-online.net
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Using NSToolbar itemForItemIdentifier properly?
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Referencing files in the app's bundle
  • Next by Date: Re: Can anyone tell me why this AppleEvent code isn't working?
  • Previous by thread: Re: Can anyone tell me why this AppleEvent code isn't working?
  • Next by thread: Re: Using NSToolbar itemForItemIdentifier properly?
  • Index(es):
    • Date
    • Thread