Skip to content

Instantly share code, notes, and snippets.

@saikat
Created July 21, 2009 18:14
Show Gist options
  • Save saikat/151498 to your computer and use it in GitHub Desktop.
Save saikat/151498 to your computer and use it in GitHub Desktop.
/*
* AppController.j
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/CPObject.j>
@import <AppKit/CPView.j>
@implementation AppController : CPObject
{
CPTextField label;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
label = [[CPTextField alloc] init];
[label setStringValue:"Hello"];
[label sizeToFit];
[label setFrameOrigin:CGPointMake([contentView frame].size.width / 2.0 - [label frame].size.width / 2.0, [contentView frame].size.height / 2.0 - [label frame].size.height / 2.0)];
[label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[label setEditable:YES];
[label setSelectable:YES];
[contentView addSubview:label];
[[label window] makeFirstResponder:label];
[label selectText:self];
[theWindow orderFront:self];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment