home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / Tutorial / Cookbook / 19.timedEntry / MyObject.m < prev    next >
Encoding:
Text File  |  1993-01-19  |  800 b   |  52 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "MyObject.h"
  5. #import <appkit/nextstd.h>
  6. #import <appkit/Form.h>
  7. #import <appkit/Application.h>
  8.  
  9. @implementation MyObject
  10.  
  11. void update (teNum, now, myself)
  12. DPSTimedEntry teNum;
  13. double now;
  14. id myself;
  15. {
  16.     [myself doTimedEntry];        
  17. }
  18.  
  19. - setForm:anObject
  20. {
  21.     form = anObject;
  22.     return self;
  23. }
  24.  
  25. - startTimedEntry:sender
  26. {
  27.     clockTE = DPSAddTimedEntry(0.1, &update, self, NX_MODALRESPTHRESHOLD);
  28.     return self;
  29. }
  30.  
  31. - stopTimedEntry:sender
  32. {
  33.     DPSRemoveTimedEntry (clockTE);
  34.     return self;
  35. }
  36.  
  37. - doTimedEntry
  38. {
  39.     static float localCounter;
  40.     localCounter += 0.1;
  41.     [form setFloatValue:localCounter];        
  42. }
  43.  
  44. // Good programming practice. Free what you create!
  45. - free
  46. {
  47.     [self stopTimedEntry:self];
  48.     return [super free];
  49. }
  50.  
  51. @end
  52.