Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Created January 12, 2010 19:41
Show Gist options
  • Save jerodsanto/275528 to your computer and use it in GitHub Desktop.
Save jerodsanto/275528 to your computer and use it in GitHub Desktop.
/*
* AppController.j
* tabKeyTest2
*
* Created by Jerod Santo on January 12, 2010.
* Copyright 2010, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPTextField one;
CPTextField two;
CPTextField three;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
one = [[CPTextField alloc] initWithFrame:CGRectMake(10,10,200,40)];
[one setFont:[CPFont fontWithName:@"Trebuchet MS" size:24]];
[one setStringValue:@"Hello World"];
[one setBezeled:YES];
[contentView addSubview:one];
two = [[CPTextField alloc] initWithFrame:CGRectMake(10,50,200,40)];
[two setFont:[CPFont fontWithName:@"Trebuchet MS" size:24]];
[two setStringValue:@"Hello World"];
[two setBezeled:YES];
[contentView addSubview:two];
three = [[CPTextField alloc] initWithFrame:CGRectMake(10,90,200,40)];
[three setFont:[CPFont fontWithName:@"Trebuchet MS" size:24]];
[three setStringValue:@"Hello World"];
[three setBezeled:YES];
[contentView addSubview:three];
var button = [[CPButton alloc] initWithFrame:CGRectMake(10,130,198,24)];
[button setTitle:@"Make Editable"];
[button setTarget:self];
[button setAction:@selector(makeFieldsEditable:)];
[contentView addSubview:button];
[theWindow orderFront:self];
}
- (void)makeFieldsEditable:(id)sender
{
[one setEditable:YES];
[two setEditable:YES];
[three setEditable:YES];
[one selectText:nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment