home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer) / NeXT_Developer-3.3.iso / NextDeveloper / Examples / IndexingKit / Ledger / KAYEditableFormatter.m < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.7 KB  |  69 lines

  1. #import "KAYEditableFormatter.h"
  2. #import "LedgerController.h"
  3.  
  4. @implementation KAYEditableFormatter
  5. - textDidEnd:textObject endChar:(unsigned short)whyEnd
  6. {
  7.     if ((whyEnd == 16)||((whyEnd == 17) && (_theColumn == _lastColumn))) {
  8.     if (NXRunAlertPanel("Confirm?", 
  9.         "Do you want to commit this transaction?",
  10.                 "Yes", "No", NULL) == NX_ALERTDEFAULT) {
  11.         [super textDidEnd:textObject endChar:0];
  12.         [_theCtlr commit:self];
  13.         [_theCtlr perform:@selector(ping:) with :self afterDelay:1 cancelPrevious:NO];
  14.     } else
  15.         [super textDidEnd:textObject endChar:0];
  16.     } else {
  17.     [super textDidEnd:textObject endChar:whyEnd];
  18.     }
  19.     return self;
  20. }
  21.  
  22. - setController:anObject
  23. {
  24.     _theCtlr = anObject;
  25.     return self;
  26. }
  27.  
  28. - setColumnLimit:(unsigned int)column
  29. {
  30.     _lastColumn = column;
  31.     return self;
  32. }
  33.  
  34. - (BOOL)editFieldAt:(unsigned int)row :(unsigned int)column inside:(NXRect *)frame inView:view
  35.     withAttributes:(id <DBTableVectors >)rowAttributes
  36.      :(id <DBTableVectors >)columnAttributes
  37.     usePositions:(BOOL)rp :(BOOL)rc
  38.     onEvent:(NXEvent *)theEvent
  39. {
  40.     _theColumn = column;
  41.     return[super editFieldAt:row :column inside:frame inView:view
  42.        withAttributes:rowAttributes
  43.         :columnAttributes
  44.        usePositions:rp :rc
  45.        onEvent:theEvent];
  46. }
  47.  
  48. - drawFieldAt:(unsigned int) row :(unsigned int) column
  49.     inside:(NXRect *) frame inView:view
  50.     withAttributes:(id <DBTableVectors>) ra
  51.               :(id <DBTableVectors>) ca
  52.     usePositions:(BOOL) rp :(BOOL) rc;
  53. {
  54. /* this is a hack to set every other row to the slightly different gray. */
  55. #ifdef NEVEREVER
  56.     if ((row % 2) == 0) {
  57.     [drawCell setBackgroundGray:0.5];
  58.     }
  59. #endif
  60.     return[super drawFieldAt:row :column
  61.     inside:frame inView:view
  62.     withAttributes:ra
  63.               :ca
  64.     usePositions:rp :rc];
  65. }
  66.  
  67. @end
  68.  
  69.