Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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
Add Comment
Please, Sign In to add comment