programmatically instantiating and displaying NSWindow
programmatically instantiating and displaying NSWindow
- Subject: programmatically instantiating and displaying NSWindow
- From: David Cairns <email@hidden>
- Date: Sat, 24 Jan 2004 18:31:39 -0500
ok, my problem is this:
I am trying to programmatically instantiate an NSWindow object, because
most of my program is in C++, and i would like to avoid using IB as
much as possible, so I have a (c++) ViewController class, in which, I
include the following:
void ViewController::init()
{
NSRect contentRect;
NSSize contentSize;
contentSize.width = 312;
contentSize.height = 88;
contentRect.origin = NSMakePoint(100, 100);
contentRect.size = contentSize;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
window = [[NSWindow alloc] initWithContentRect:contentRect
styleMask:(NSTitledWindowMask | NSClosableWindowMask)
backing:(NSBackingStoreBuffered)
defer:YES];
glView = [[GameView alloc] initWithFrame:[[window contentView]
bounds]
colorBits:16
depthBits:16
fullscreen:FALSE ];
[window setContentView:glView];
[window makeKeyAndOrderFront:nil];
[pool release];
}
(note: GameView is a subclass of NSOpenGLView)
for some reason, I get
Uncaught exception: <NSInternalInconsistencyException> Error (1002)
creating CGSWindow
pro_05 has exited due to signal 5 (SIGTRAP).
whenever the function gets to the "[window makeKeyAndOrderFront:nil];"
call, and the program exits. I've thoroughly checked the archive, but
i can't seem to find anything about this problem, at least not that
will help me.
Thanks again for any help...
-- david
also, thanks for the help with the switch statement thing, I really
appreciate it...
_______________________________________________
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.