PDA

View Full Version : Initialize a window before showing it




isthisonetaken
Nov 28, 2010, 01:08 PM
Hey all,

so I have an application which starts with a login window, and after successful login opens the main window. What I would like to have happen, is once the login is successful, load the information I need from the database to populate the main window, then show the main window and close the login.

So far, I have both windows in MainMenu.xib, the main window is hidden at launch, the login window shows, and the login code is written and works. When the login is successful I call this code:
[blackboxWindow orderFront:self];
[loginWindow close];
I have the code to initialize blackboxWindow in awakeFromNib and my problem is that I have a NSRunAlert to show me what is being returned, and that is popping up even before the login window shows.

I feel like the problem is in the awakeFromNib, but if I put the code in the applicationDidFinishLaunching, the same problem happens. Is there a way to call something like applicationDidFinishLaunching, but just before a window is shown?

Thanks,

Dan



gnasher729
Nov 28, 2010, 02:28 PM
Hey all,

so I have an application which starts with a login window, and after successful login opens the main window. What I would like to have happen, is once the login is successful, load the information I need from the database to populate the main window, then show the main window and close the login.

So far, I have both windows in MainMenu.xib, the main window is hidden at launch, the login window shows, and the login code is written and works. When the login is successful I call this code:
[blackboxWindow orderFront:self];
[loginWindow close];
I have the code to initialize blackboxWindow in awakeFromNib and my problem is that I have a NSRunAlert to show me what is being returned, and that is popping up even before the login window shows.

I feel like the problem is in the awakeFromNib, but if I put the code in the applicationDidFinishLaunching, the same problem happens. Is there a way to call something like applicationDidFinishLaunching, but just before a window is shown?

Well, yes. Just write some code and call it before you call orderFront.

isthisonetaken
Nov 28, 2010, 03:32 PM
Well, yes. Just write some code and call it before you call orderFront.
There should be a smiley doing a face palm. Thanks gnasher729.