• 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: NSToolbar question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSToolbar question


  • Subject: Re: NSToolbar question
  • From: Chris Giordano <email@hidden>
  • Date: Mon, 18 Feb 2002 19:26:45 -0500

Thilo,

You shouldn't need to subclass to get a toolbar.

I've included toolbars in both document and non-document based applications. Basically all you have to do is implement a few delegate methods in a class that will act as the delegate to your toolbar instance. Then, in your awakeFromNib: or windowControllerDidLoadNib: method (depending on your application type), create and set up your toolbar, and set the appropriate class as the delegate. It should just work from there.

I used my document class (or controller class, in my non-document based app) as the delegate, so my code looked something like this:

in MyDocument.m:
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
// some other stuff
[self setUpToolbar];
}

- (void) setUpToolbar
{
NSToolbar * toolbar;
// create the toolbar instance
// add the necessary toolbar items to this toolbar

// set the toolbar's delegate to this class:
[toolbar setDelegate:self];
// tell my window where its toolbar is:
[[theTableView window] setToolbar:toolbar];
}

I'd highly recommend taking a look at the SimpleToolbar example that Apple provides (/Developer/Examples/AppKit/SimpleToolbar). It is where I got most of my information (and code) from to do this.

chris

On Friday, January 18, 2002, at 05:20 PM, Thilo Ettelt wrote:

Hi!

Do I need to subclass NSWindow in order to get a working toolbar?
I subclassed NSObject, Instanciated it and did a lot of stuff, but the toolbar isn't shown :(


Cheers, Thilo
_______________________________________________
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.
_______________________________________________
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.

  • Prev by Date: Japanese vertical text
  • Next by Date: NSThread does not respond the the 'exit' message
  • Previous by thread: Re: Japanese vertical text
  • Next by thread: NSThread does not respond the the 'exit' message
  • Index(es):
    • Date
    • Thread