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 Jun 11, 2009, 12:12 AM   #1
Aranince
macrumors 65816
 
Join Date: Apr 2007
Location: California
Hide/Show NSWindow?

I'm trying to create a preference window, but I am having a problem bringing the window "back to life." When I first launch the program and open the pref window, it opens fine. I then close the pref window and try to open it again and no window pops up. How do I get the window to come back up after I close it? Here is how I open it in the first place through the window controller:

Code:
-(void)showPreferenceWindow:(id)sender
{
	[NSApp activateIgnoringOtherApps:YES];
	[[self window] center];
	[[self window] makeKeyAndOrderFront:nil];	
}
...and in the NSWindow subclass I just have

Code:
-(void)awakeFromNib
{
	[self setHidesOnDeactivate:NO];
	[self setReleasedWhenClosed:NO];
}
Aranince is offline   0 Reply With Quote
Old Jun 11, 2009, 12:40 AM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
Are you sure awakeFromNib is being called? Is [self window] non-nil? Don't assume things are what you think they are. Use the debugger or logging
kainjow is offline   0 Reply With Quote
Old Jun 11, 2009, 06:16 PM   #3
Aranince
Thread Starter
macrumors 65816
 
Join Date: Apr 2007
Location: California
awakeFromNib is being called...[self window] is nil(assuming I'm checking it correctly: [self window] == nil ) and the window controller's init method is being called and succeeding.

My init method for the controller

Code:
-(id)init
{
	if((self = [super initWithWindowNibName:@"GHPreferences"]))
	{

	}
	return self;
}
Why would self window be nil? It's nil the first time I open the pref window...which I find strange. Does [self window] not exist until I call makeKeyAndOrderFront?

EDIT: I tried if([self isWindowLoaded] == NO) and the case is only true once.

Last edited by Aranince; Jun 11, 2009 at 06:23 PM.
Aranince 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
Show/Hide Full Path of Files arianartizan OS X 10.8 Mountain Lion 6 Jan 2, 2013 12:41 PM
iTunes 11: Hide TV Show Descriptions? ayzee Apple TV and Home Theater 0 Dec 6, 2012 02:45 PM
Show & hide app darksiders Mac Basics and Help 0 Oct 12, 2012 07:55 AM
General: The apps show up after hide them Processor iOS 6 2 Oct 11, 2012 04:58 AM
How to show/hide objects in Cocoa Applescript application sjmonty99 Mac Programming 3 Aug 6, 2012 11:02 AM

Forum Jump

All times are GMT -5. The time now is 06:07 AM.

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

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