• 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
Re: Programmatic NSWindows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: NSBrowser bug?
  • Next by Date: Re: NSBrowser bug?
  • Previous by thread: Programmatic NSWindows
  • Next by thread: NSTextStorage refreshing NSTextView
  • Index(es):
    • Date
    • Thread