Skip to content

Instantly share code, notes, and snippets.

@RonchettiAssociati
Created January 9, 2010 11:02
Show Gist options
  • Save RonchettiAssociati/272852 to your computer and use it in GitHub Desktop.
Save RonchettiAssociati/272852 to your computer and use it in GitHub Desktop.
/*
* AppController.j
* WktTest62
*
* Created by Bruno Ronchetti on Janurary 9, 2010.
* Copyright 2010, Ronchetti & Associati All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var button1 = [[CPButton alloc] initWithFrame:CGRectMake(10,10,100,24)];
[button1 setTitle:"Button 1"];
[button1 setTag:"Data Associated with Button 1"];
[button1 setTarget:self];
[button1 setAction:"pressed:"];
[contentView addSubview:button1];
var button2 = [[CPButton alloc] initWithFrame:CGRectMake(10,60,100,24)];
[button2 setTitle:"Button 2"];
[button2 setTag:"Data Associated with Button 2"];
[button2 setTarget:self];
[button2 setAction:"pressed:"];
[contentView addSubview:button2];
var button3 = [[CPButton alloc] initWithFrame:CGRectMake(10,110,100,24)];
[button3 setTitle:"Button 3"];
[button3 setTag:button1];
[button3 setTarget:self];
[button3 setAction:"pressed:"];
[contentView addSubview:button3];
label = [[CPTextField alloc] initWithFrame:CGRectMake(10,160,300,24)];
[label setStringValue:@"Hello World!"];
[label setFont:[CPFont systemFontOfSize:18]];
[label sizeToFit];
[contentView addSubview:label];
[theWindow orderFront:self];
}
-(void)pressed:(CPButton)aSender
{
[label setStringValue:[aSender tag]];
[label sizeToFit];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment