Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 15, 2013, 07:08 AM   #1
Dreamspinner
macrumors member
 
Join Date: Dec 2012
Window doesn't show

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 by Dreamspinner; Feb 15, 2013 at 08:51 AM.
Dreamspinner is offline   0 Reply With Quote
Old Feb 15, 2013, 11:42 AM   #2
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
Are you sure "Colors.xib" is assigned the correct Target Membership? Does it even exist and is named correctly?
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   1 Reply With Quote
Old Feb 15, 2013, 01:09 PM   #3
Dreamspinner
Thread Starter
macrumors member
 
Join Date: Dec 2012
Quote:
Originally Posted by ElectricSheep View Post
Are you sure "Colors.xib" is assigned the correct Target Membership? Does it even exist and is named correctly?
AHA! You nailed it. It is actually named "PreferenceController". "Colors" is the title.
Dreamspinner is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting 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

Forum Jump


All times are GMT -5. The time now is 10:02 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC