FROM : Philip Lee Bridson
DATE : Sun Jun 15 22:59:12 2008
Hi There,
I used the notification like suggested and I still cannot display my
window.
This is my code:
-(void)applicationDidFinishLaunching:(NSNotification *)notification
{
printf("In Delegate method.\n"); //DEBUG
winCtrl = [[NSWindowController alloc] initWithWindowNibName:@"Window"];
[winCtrl showWindow:self]; //I have also tried [winCtrl showWindow:
[winCtrl window]];
}
I have no idea why this does not work, the DEBUG info is printed to
stdout and the rest of the code I use all the time so I am honestly
none the wiser. I believe the delegate method works otherwise the
text would not be printed to stdout but my second window will not
display like it is supposed to. I am at a loss.
Can anyone help?
Many thanks.
Phil.
On 15 Jun 2008, at 19:31, Marcel Weiher wrote:
>
> On Jun 15, 2008, at 10:09 , Philip Lee Bridson wrote:
>
>> Firstly I need a function to automatically run from a class used
>> in MainMenu.nib when the main.m calls NSApplicationMain();
>
> The NSApplication object provides this facility:
>
> http://developer.apple.com/documentation/Cocoa/Reference/
> ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html
>
>
> --- snip ---
> -applicationDidFinishLaunching:
> Sent by the default notification center after the application has
> been launched and initialized but before it has received its first
> event.
>
> - snip ---
>
> You'll need to create that delegate object and hook it up to your
> application object.
>
>> Also, I cannot figure out why when I initialize a window from a
>> nib or from a file before the call to NSApplicationMain() the
>> program crashes due to a memory leak.
>
> Programs tend not to crash from memory leaks unless the leak is
> large+long enough that you run out of memory.
>
>> I have tried to put the function in awakeFromNib but then the
>> window wont close itself from that function.
>
> awakeFromNib is not the appropriate place for this.
>
> Marcel
>
DATE : Sun Jun 15 22:59:12 2008
Hi There,
I used the notification like suggested and I still cannot display my
window.
This is my code:
-(void)applicationDidFinishLaunching:(NSNotification *)notification
{
printf("In Delegate method.\n"); //DEBUG
winCtrl = [[NSWindowController alloc] initWithWindowNibName:@"Window"];
[winCtrl showWindow:self]; //I have also tried [winCtrl showWindow:
[winCtrl window]];
}
I have no idea why this does not work, the DEBUG info is printed to
stdout and the rest of the code I use all the time so I am honestly
none the wiser. I believe the delegate method works otherwise the
text would not be printed to stdout but my second window will not
display like it is supposed to. I am at a loss.
Can anyone help?
Many thanks.
Phil.
On 15 Jun 2008, at 19:31, Marcel Weiher wrote:
>
> On Jun 15, 2008, at 10:09 , Philip Lee Bridson wrote:
>
>> Firstly I need a function to automatically run from a class used
>> in MainMenu.nib when the main.m calls NSApplicationMain();
>
> The NSApplication object provides this facility:
>
> http://developer.apple.com/documentation/Cocoa/Reference/
> ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html
>
>
> --- snip ---
> -applicationDidFinishLaunching:
> Sent by the default notification center after the application has
> been launched and initialized but before it has received its first
> event.
>
> - snip ---
>
> You'll need to create that delegate object and hook it up to your
> application object.
>
>> Also, I cannot figure out why when I initialize a window from a
>> nib or from a file before the call to NSApplicationMain() the
>> program crashes due to a memory leak.
>
> Programs tend not to crash from memory leaks unless the leak is
> large+long enough that you run out of memory.
>
>> I have tried to put the function in awakeFromNib but then the
>> window wont close itself from that function.
>
> awakeFromNib is not the appropriate place for this.
>
> Marcel
>
| Related mails | Author | Date |
|---|---|---|
| Philip Lee Bridson | Jun 15, 19:09 | |
| Stephen J. Butler | Jun 15, 20:29 | |
| Marcel Weiher | Jun 15, 20:31 | |
| Philip Lee Bridson | Jun 15, 22:59 | |
| Ken Thomases | Jun 15, 23:16 | |
| Philip Lee Bridson | Jun 15, 23:25 |






Cocoa mail archive

