• 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: Toolbar item like Finder 'view' item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Toolbar item like Finder 'view' item


  • Subject: Re: Toolbar item like Finder 'view' item
  • From: Alex Rice <email@hidden>
  • Date: Mon, 22 Apr 2002 14:51:11 -0600

On Monday, April 22, 2002, at 02:32 PM, Chris Meyer wrote:

Hi,

What is the best way to put a toolbar item that works like the 'view' selector in the Finder toolbar into my application? Is it possible to do it from PB? Is it possible to do it without creating a custom class?

No custom class is needed. First in Interface Builder create an NSView with whatever content you want for your toolbar item. Then connect this view to an outlet in your PB class, say the outlet is named:

IBOutlet NSView *myToolbarView;

Then in the NSToolbar delegate method -toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: the code to connect it the toolbar item to it's view is something like:

NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease];

[item setView: myToolbarView];
[item setMinSize:NSMakeSize(48,32)]; // or whatever
[item setMaxSize:NSMakeSize(48,32)];
[item setLabel:NSLocalizedString(@"Tool Label", nil)];
[item setPaletteLabel:NSLocalizedString(@"Tool Label", nil)];
[item setToolTip:NSLocalizedString(@"Do the thing", nil)];
[item setAction:@selector(myToolbarViewAction:)];


Alex Rice <email@hidden>
Mindlube Software
http://www.mindlube.com/
_______________________________________________
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.

References: 
 >Toolbar item like Finder 'view' item (From: Chris Meyer <email@hidden>)

  • Prev by Date: Toolbar item like Finder 'view' item
  • Next by Date: Re: "Space" key equivalent for menu items
  • Previous by thread: Toolbar item like Finder 'view' item
  • Next by thread: copy and deepcopy
  • Index(es):
    • Date
    • Thread