• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
programmatically instantiating and displaying NSWindow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: programmatically instantiating and displaying NSWindow
      • From: Chris Hanson <email@hidden>
    • Re: programmatically instantiating and displaying NSWindow
      • From: "b.bum" <email@hidden>
  • Prev by Date: Cocoa from the command line?
  • Next by Date: Re: NSTimer, no invalidate while shutting down?
  • Previous by thread: Re: Cocoa from the command line?
  • Next by thread: Re: programmatically instantiating and displaying NSWindow
  • Index(es):
    • Date
    • Thread