Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dreamspinner

macrumors member
Original poster
Dec 17, 2012
39
0
I have a preferences window that should open when the Main Menu item "Preferences" is selected. It's action is set to showPreferencePanel in AppController.m. The code is called, I can step thru it in the debugger, but has no effect. What am I missing? The debug console shows

2013-02-15 09:47:40.533 RotorDCU[22113:303] -[PreferenceController loadWindow]: failed to load window nib file 'Colors'.

Code:
//  PreferenceController.h
#import <Cocoa/Cocoa.h>

@interface PreferenceController : NSWindowController{
	IBOutlet NSColorWell *bgColorWell;
	IBOutlet NSColorWell *textColorWell;
	
}
- (IBAction)setBGColor:(id)sender;
- (IBAction)setTextColor:(id)sender;
@end

//  PreferenceController.m
#import "PreferenceController.h"
#import "AppController.h"

@interface PreferenceController ()

@end

@implementation PreferenceController

-(id)init
{
	self = [super initWithWindowNibName:@"Colors"];
	if (self) {
			// Initialization code here.
	}
	return self;
}

- (void)windowDidLoad
{
    [super windowDidLoad];
    
    // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}

- (IBAction)setBGColor:(NSColorWell *)sender {
}

- (IBAction)setTextColor:(NSColorWell *)sender {
}
@end

//  AppController.h
#import <Cocoa/Cocoa.h>
#import "AMSerialPort.h"
#import <Foundation/Foundation.h>

@class PreferenceController;

@interface AppController : NSObject {
  	NSColor *myColor;
	PreferenceController *preferenceController;
}

@property (nonatomic,retain) NSColor *myColor;

- (IBAction)showPreferencePanel:(id)sender;
@end

//  AppController.m
#import "AppController.h"
#import "AMSerialPortList.h"
#import "AMSerialPortAdditions.h"
#import "PreferenceController.h"

@implementation AppController
@synthesize serialPort;
@synthesize myColor;

- (void)awakeFromNib
{	
}

-(void)applicationDidFinishLaunching:(NSNotification *) notice
{
}
- (IBAction)showPreferencePanel:(id)sender{
	if (!preferenceController)
	{
		preferenceController = [[PreferenceController alloc]init];
	}
	[preferenceController showWindow:self];
}
@end
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.