Re: Programmatic NSWindows
Re: Programmatic NSWindows
- Subject: Re: Programmatic NSWindows
- From: Robert Lee Dotson <email@hidden>
- Date: Wed, 10 Jul 2002 20:08:00 -0400
In the compile log there were no lines mentioned, so I had a hard time
telling which line had the error. It ended up being the [NSScreen
visibleFrame] which should have been [[NSScreen deepestScreen]
visibleFrame];
Now it compiles, but when it runs, I get 'couldn't create context for cntx
0, window -1'
I'm just trying to get a cocoa tool to open a blank window, nothing else.
The fixed code is as follows:
#import <Cocoa/Cocoa.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSWindow *myWindow;
NSWindowController *windowController;
myWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen
deepestScreen] visibleFrame]
styleMask:NSClosableWindowMask
backing:NSBackingStoreNonretained
defer:NO];
windowController = [[NSWindowController alloc] initWithWindow:myWindow];
[myWindow makeKeyAndOrderFront:myWindow];
[pool release];
return 0;
}
If I change [myWindow makeKeyAndOrderFront] to [windowController
showWindow:myWindow] I get the same result.
R
_______________________________________________
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.