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

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

Similar Threads
thread Thread Starter Forum Replies Last Post
Hide/show dock faster wesleyh OS X 48 Dec 4, 2012 05:48 PM
unable to show back the NSWindow when using CGDisplay Monaj Mac Programming 3 Jun 9, 2011 09:18 AM
Apple Menu Bar: Mouse-over auto hide and show zdlyons OS X 8 Feb 27, 2011 01:51 PM
Show bouncing icons when dock hidden dup Mac Basics and Help 3 Jan 17, 2011 06:47 AM
Hiding/showing text Macnoviz Web Design and Development 5 Jun 19, 2007 09:38 AM


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

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

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