| Sign In/My Account | View Cart |
| Article: |
Creating Toolbars for Mac OS X | |
| Subject: | Customize menu item disabled | |
| Date: | 2002-03-31 13:19:59 | |
| From: | zeus | |
|
Hello everyone, I'm a bit late on this tutorial. I try to finish the first part of it before customization and my problem is that the "Customize Toolbar" menu item is disabled (when I'm running the soft or even when I'm testing the interface in Interface Builder). Does anyone know how to solve the problem? |
||
Showing messages 1 through 3 of 3.
It's perfectly normal that the item is disabled in Interface Builder as the toolbar is not initialized.
In your code, in Controller.m, you have to set up the toolbar.
in awakeFromNib:
[self setUpToolbar];
and then add the following method in Controller.m:
- (void) setupToolbar
{
NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier: @"mainToolbar"] autorelease];
[toolbar setDelegate: self];
[toolbar setAllowsUserCustomization: YES];
[toolbar setAutosavesConfiguration: YES];
[mainWindow setToolbar: toolbar];
}
In controller.h , declare it:
- (void) setupToolbar;
And don't omit to implement the toolbar category.
Hope this helps you,
Michèle