Guest User

Untitled

a guest
May 26th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. /*
  2. * AppController.j
  3. * AccTest
  4. *
  5. * Created by Thomas Ingham on May 17, 2010.
  6. * Copyright 2010, Your Company All rights reserved.
  7. */
  8.  
  9. @import <Foundation/CPObject.j>
  10.  
  11. @implementation AppController : CPObject
  12. {
  13. CPDictionary myDictionary;
  14. }
  15.  
  16. - (void)applicationDidFinishLaunching:(CPNotification)aNotification
  17. {
  18. var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
  19. contentView = [theWindow contentView];
  20.  
  21. myDictionary = [[CPDictionary alloc] init];
  22.  
  23. [myDictionary addObserver:self
  24. forKeyPath:@"aKey"
  25. options:CPKeyValueObservingOptionNew
  26. context:nil];
  27.  
  28. [myDictionary setValue:@"Bob Jones" forKey:@"aKey"];
  29. [myDictionary setValue:@"Jo Bob Ray" forKey:@"aKey"];
  30.  
  31. [CPTimer scheduledTimerWithTimeInterval:3
  32. target:self
  33. selector:@selector(modValue)
  34. userInfo:nil
  35. repeats:NO];
  36.  
  37. [theWindow orderFront:self];
  38.  
  39. // Uncomment the following line to turn on the standard menu bar.
  40. //[CPMenu setMenuBarVisible:YES];
  41. }
  42.  
  43. - (void)modValue {
  44. CPLog(@"changing the value in the key.");
  45. [myDictionary setValue:@"Alpha Beta Boo" forKey:@"aKey"];
  46. }
  47.  
  48. - (void)observeValueForKeyPath:(CPString *)keyPath
  49. ofObject:(id)object
  50. change:(CPDictionary *)change
  51. context:(void)context {
  52. CPLog(@"observed value change");
  53. }
  54.  
  55. @end
Add Comment
Please, Sign In to add comment