Skip to content

Instantly share code, notes, and snippets.

@saikat
Created October 18, 2009 00:41
Show Gist options
  • Save saikat/212504 to your computer and use it in GitHub Desktop.
Save saikat/212504 to your computer and use it in GitHub Desktop.
/*
* AppController.j
* NewApplication
*
* Created by You on July 5, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPTextField label;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[label setStringValue:@"Hello World!"];
[label setFont:[CPFont boldSystemFontOfSize:24.0]];
[label sizeToFit];
[label setEditable:YES];
[label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[label setCenter:[contentView center]];
[contentView addSubview:label];
[theWindow orderFront:self];
[label setDelegate:self];
[[label window] makeFirstResponder:label];
[label setSelectable:YES];
[label setEnabled:YES];
[label selectText:self];
}
- (void)controlTextDidBeginEditing:(CPNotification)aNotification
{
[label setStringValue:"Did begin editing"];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment