home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Utilities / CATax-2.0-MIS / Regular.m < prev   
Encoding:
Text File  |  1997-02-26  |  1.0 KB  |  44 lines

  1. #import "Regular.h"
  2.  
  3. @implementation Regular
  4.  
  5. - (void)Calc:(id)sender
  6. {
  7.     // Decalare Variables    
  8.     float price, catax, total;
  9.  
  10.     // Assign the number in the field to the price variable
  11.     price = [Price floatValue];
  12.  
  13.     // Do a little calculation
  14.     catax = (price*0.0825);
  15.     total = (price+catax);
  16.  
  17.     // Display result in the panel
  18.     // Sets TextField as a NSFloatType
  19.     [[CATax cell] setEntryType:NSFloatType];
  20.     [[Total cell] setEntryType:NSFloatType];
  21.     // Format the TextField with two number at the left of the floating point
  22.     // and two numbers at the right of the floating point.
  23.     [[CATax cell] setFloatingPointFormat:NO left:3 right:2];
  24.     [[Total cell] setFloatingPointFormat:NO left:3 right:2];
  25.  
  26.     [CATax setFloatValue:catax];// Display result
  27.     [Total setFloatValue:total];
  28.  
  29.     // Bring the cusor back to the Price field and select it.
  30.     [Price selectText:self];
  31. }
  32.  
  33.  
  34. - (void)windowDidBecomeKey:(NSNotification *)notification;
  35. {
  36.  
  37.     // Brings the cursor to the field and selects text
  38.     [Price selectText:self];
  39.  
  40. }
  41.  
  42.  
  43. @end
  44.