• 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 Windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatic Windows


  • Subject: Re: Programmatic Windows
  • From: John Hörnkvist <email@hidden>
  • Date: Wed, 13 Jun 2001 22:27:28 +0200

On Wednesday, June 13, 2001, at 09:33 PM, email@hidden wrote:

Anyone have any thoughts about creating NSWindows in code? I keep getting errors that say 'NSWindow doesn't respond to alloc.'

I'm writing a small app, and I don't want to load this window from a nib. Any help would be greatly appreciated.

One has to wonder why...

This code is snipped from an application that worked (at least) on OPENSTEP 4.2 and Mac OS X Server 1.2:

NS_DURING
window=[[NSWindow alloc] initWithContentRect:(NSRect){{100,0},{512,505}} styleMask:NSClosableWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|
NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO];
[window setReleasedWhenClosed:NO];
[window setResizeIncrements:(NSSize){5,1}];
[window setMinSize:(NSSize){300,400}];

// [[window contentView] addSubview: ...];

[window setDelegate:self];
NS_HANDLER
NSLog(@"%@: %@ -- %@ -- %@",NSStringFromClass([self class]),[localException name],[localException reason],[localException userInfo]);
[localException raise];
NS_ENDHANDLER

Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com


References: 
 >Programmatic Windows (From: email@hidden)

  • Prev by Date: Re: Programmatic Windows
  • Next by Date: Re: WWDC Developer Tools Online - install problem
  • Previous by thread: Re: Programmatic Windows
  • Next by thread: Re: Programmatic Windows
  • Index(es):
    • Date
    • Thread