Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Preferences Panel: No Progress
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preferences Panel: No Progress



Maybe I'm just lazy, but for my document based app I put the prefs panel in my MainMenu.nib and connected preferences... to the makeKeyAndOrderFront: action on the panel. Works for me.

HTH,
TR

On Jul 16, 2004, at 1:31 PM, Albion Baucom wrote:

Im still getting no where with this one. Help.

This is a document based application, so the NSWindowController stuff is a
little more complicated.

1. I can't get a preferences panel to display. I created a preferences
panel in IB, and made its file owner "Preferences". I have a Preferences.m
and Preferences.h file in my Xcode project. I created an outlet for a
NSWindowController (preferencesPanelController), and an outlet for a
NSPanel (preferencesPanel) and connected them via IB in the Preferences
NIB, and the preferences menu option in my MainMenu NIB.

(follow-up: I have checked, double checked my connections. I looked at the
developer example TextEdit that has a preferences panel, and the
"accessory" window example in my Learning Objective-C with Cocoa book).

So, when I try to open the preferences via the menu option, I see that my
method is called; "showPanel called" is printed, but the panel never
appears. I don't get an error, I have tried inside and out of the if()
statement checking if the preferencesPanelController has been
instantiated, and the NSLog shows a healthy NSWindowController object.

My Preferences.nib file lives in the same directory in the project as the
MainMenu.nib file, and I never get an error that the NIB failed to load.

Here is the showPanel code that I have connected to the "Preferences ..."
menu option

- (IBAction)showPanel:(id)sender
{
printf("showPanel called\n");

if(!preferencesPanelController)
{
if (![NSBundle loadNibNamed:@"Preferences" owner:self])
{
NSLog(@"Failed to load Preferences.nib");
NSBeep();
return;
}

preferencesPanelController = [[NSWindowController alloc]
initWithWindow:preferencesPanel];
NSLog(@"preferencesPanelController %@",
preferencesPanelController);
}

[preferencesPanelController showWindow:self];
}


Could this be opening offscreen?? There is simply no errors generated, and
this code on the first call prints this

showPanel called
2004-07-16 12:26:27.888 MOViewer[557] preferencesPanelController
<NSWindowController: 0x147c9d0>

and on subsequent calls I get just this

showPanel called

All is normal, EXCEPT THAT THE WINDOW NEVER IS DISPLAYED! Ahhh. I have
spent a lot of time trying to figure this one out. I may just start a test
project to see if I can write code to make any window appear. The examples
work fine, but I can't find the difference between their code and mine
(either in Xcode or IB).

What am I missing?!

Thanks

Albion
_______________________________________________
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.


References: 
 >Preferences Panel: No Progress (From: Albion Baucom <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.