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

Similar Threads
thread Thread Starter Forum Replies Last Post
Why does it now only show the first name at the top of a message window? TH55 iOS 7 9 Feb 10, 2014 09:45 PM
Resolved: Aperture 3: in import window show only what hasn't been imported mlsusa Mac Applications and Mac App Store 14 May 20, 2013 11:47 AM
Show Window without activating (keep application below it active) wesleyh Mac Programming 0 Feb 26, 2013 04:08 AM
How to show FileMerge in full window mikezang iPhone/iPad Programming 3 Jan 28, 2013 10:29 AM
Maximized Window doesn't use ~6px at the bottom? oschrenk OS X 10.8 Mountain Lion 2 Aug 28, 2012 05:22 AM

Forum Jump

All times are GMT -5. The time now is 08:23 PM.

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

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