Re: Program flow in NSApplication
Re: Program flow in NSApplication
- Subject: Re: Program flow in NSApplication
- From: Andreas Schempp <email@hidden>
- Date: Mon, 28 Apr 2003 16:31:27 +0200 (MEST)
Do get the applicationWillFinishLaunching and the other four functions to
work, you have to register your application at the notification center.
you should do something like this:
- (void) awakeFromNib
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillFinishLaunching:)
name:@"NSApplicationWillFinishLaunchingNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidFinishLaunching:)
name:@"NSApplicationDidFinishLaunchingNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillBecomeActive:)
name:@"NSApplicationWillBecomeActiveNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidBecomeActive:)
name:@"NSApplicationDidBecomeActiveNotification" object:nil];
}
And check for spelling errors ;-)
>
Hi,
>
>
I have created a sample application in Cocoa using a
>
custom view. i then subclassed the view from
>
NSScrollView.
>
Now in the code all the coding for creating the
>
matrix and NSButtonCells in the matrix is done in -
>
(id)initWithFrame:(NSRect)frameRect
>
>
I have a delegate from the FistOwner to class instance
>
controller. I have defined functions like
>
-(void)applicationWillFinishLaunching:(NSNotification
>
*)aNotification
>
{
>
>
}
>
>
- (void)applicationDidBecomeActive:(NSNotification
>
*)aNotification
>
{
>
>
}
>
>
- (void)applicationDidFinishLaunching:(NSNotification
>
*)aNotification
>
{
>
>
}
>
>
- (void)applicationWillBecomeActive:(NSNotification
>
*)aNotification
>
{
>
>
}
>
>
just for testing purpose to find whether the program
>
control reaches any of these functions. but i found
>
that - (id)initWithFrame:(NSRect)frameRect function
>
finishes all the processing and control does not reach
>
the 4 functions mentioned above.
>
>
i had also used -(void)awakefromNib function. But
>
when the program starts executing the control first
>
goes to - (id)initWithFrame:(NSRect)frameRect.
>
What could be going wrong or is this the normal
>
behaviour?
>
Is there any documentation available which tells the
>
flow of the program for NSApplication.
>
>
Thanks.
>
>
with rgds,
>
johnd
>
>
__________________________________
>
Do you Yahoo!?
>
The New Yahoo! Search - Faster. Easier. Bingo.
>
http://search.yahoo.com
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.