Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > "File" does not respond to "setToolbar:"...

"File" does not respond to "setToolbar:"...
Thread Tools
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jun 16, 2003, 01:10 PM
 
Hey guys,

I have this code:

- (void)setToolBar
{
NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier: _ToolBar] autorelease];
[toolbar setAllowsUserCustomization: NO];
[toolbar setAutosavesConfiguration: YES];
[toolbar setDelegate: self];
[prefWindow setToolbar: toolbar];
}

That sets up a toolbar on a preferences window, so I called [self setToolBar]; in awakeFromNib. But, even though it is a warning. I get "Preferences" does not respond to "setToolBar:". This gets quite annoying since I prefer no warnings. This also happens when I try other toolbars.
     
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Jun 16, 2003, 02:55 PM
 
Hmm, sounds like the prefs window isn't available yet...even though it's sloppy coding just for a test put the toolbar code in awakeFromNib, the following works fine for me:

-(void)awakeFromNib
{
custWindow = [self window];

// toolbar

NSToolbar *toolbar;
toolbar = [[NSToolbar alloc] initWithIdentifier:@"tooltest"];
[toolbar setDelegate:self];

// Make the toolbar configurable
[toolbar setAllowsUserCustomization:YES];
[toolbar setAutosavesConfiguration:YES];

// Attach the toolbar to the window
[custWindow setToolbar:toolbar];

// toolbar is retained by the window
[toolbar release];
}



Steve W
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Offline
Reply With Quote
Jun 16, 2003, 03:10 PM
 
also try casting prefWindow as an NSWindow

[(NSWindow *)prefWindow setToolbar:toolbar];
     
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Jun 16, 2003, 08:44 PM
 
But, even though it is a warning. I get "Preferences" does not respond to "setToolBar:".
This has all the marks of an undeclared method.

Before this line in your .m file:
Code:
@implementation Preferences
Add this:
Code:
@interface Preferences (Private) - (void)setToolBar; @end
Then all should be well. I hope.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:42 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2