• 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: subclassing a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: subclassing a window


  • Subject: RE: subclassing a window
  • From: "Lars Elden" <email@hidden>
  • Date: Tue, 7 Feb 2006 02:14:03 +0100

ok, got it working. This little sample creates a window and the application
terminates when the window is closed. Lars

#import <Cocoa/Cocoa.h>

@interface Window : NSWindow
{
}
- ( BOOL ) windowShouldClose : ( id ) sender;
@end

@implementation Window
- ( BOOL ) windowShouldClose  : ( id ) sender
{
   [ NSApp terminate : self ];
   return TRUE;
}
@end

int main( int argc, char *argv[] )
{
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
   NSApplication * app = [NSApplication sharedApplication];
   Window * win = [[Window alloc] initWithContentRect:NSMakeRect( 200, 200,
600, 400 )
                                     styleMask:( NSTitledWindowMask |
NSResizableWindowMask |
                                     NSClosableWindowMask |
NSMiniaturizableWindowMask )
                                     backing:NSBackingStoreBuffered defer:
YES ];

  [win setTitle:@"Tutor02"];

  [app runModalForWindow: win ];
  [app release];
  [pool release];

  return EXIT_SUCCESS;
}



______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: subclassing a window
      • From: "John C. Randolph" <email@hidden>
References: 
 >Re: subclassing a window (From: Finlay Dobbie <email@hidden>)

  • Prev by Date: Re: Advice on restricting/monitoring character input in NSTextView
  • Next by Date: Re: Fastest way to predict bounding box for a string
  • Previous by thread: Re: subclassing a window
  • Next by thread: Re: subclassing a window
  • Index(es):
    • Date
    • Thread