Re: Programmatic Windows
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