Created
May 21, 2010 03:19
-
-
Save tingham/408413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* AppController.j | |
* AccTest | |
* | |
* Created by Thomas Ingham on May 17, 2010. | |
* Copyright 2010, Your Company All rights reserved. | |
*/ | |
@import <Foundation/CPObject.j> | |
@implementation AppController : CPObject | |
{ | |
CPDictionary myDictionary; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], | |
contentView = [theWindow contentView]; | |
myDictionary = [[CPDictionary alloc] init]; | |
[myDictionary addObserver:self | |
forKeyPath:@"aKey" | |
options:CPKeyValueObservingOptionNew | |
context:nil]; | |
[myDictionary setValue:@"Bob Jones" forKey:@"aKey"]; | |
[myDictionary setValue:@"Jo Bob Ray" forKey:@"aKey"]; | |
[CPTimer scheduledTimerWithTimeInterval:3 | |
target:self | |
selector:@selector(modValue) | |
userInfo:nil | |
repeats:NO]; | |
[theWindow orderFront:self]; | |
// Uncomment the following line to turn on the standard menu bar. | |
//[CPMenu setMenuBarVisible:YES]; | |
} | |
- (void)modValue { | |
CPLog(@"changing the value in the key."); | |
[myDictionary setValue:@"Alpha Beta Boo" forKey:@"aKey"]; | |
} | |
- (void)observeValueForKeyPath:(CPString *)keyPath | |
ofObject:(id)object | |
change:(CPDictionary *)change | |
context:(void)context { | |
CPLog(@"observed value change"); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment