home *** CD-ROM | disk | FTP | other *** search
- #import "Regular.h"
-
- @implementation Regular
-
- - (void)Calc:(id)sender
- {
- // Decalare Variables
- float price, catax, total;
-
- // Assign the number in the field to the price variable
- price = [Price floatValue];
-
- // Do a little calculation
- catax = (price*0.0825);
- total = (price+catax);
-
- // Display result in the panel
- // Sets TextField as a NSFloatType
- [[CATax cell] setEntryType:NSFloatType];
- [[Total cell] setEntryType:NSFloatType];
- // Format the TextField with two number at the left of the floating point
- // and two numbers at the right of the floating point.
- [[CATax cell] setFloatingPointFormat:NO left:3 right:2];
- [[Total cell] setFloatingPointFormat:NO left:3 right:2];
-
- [CATax setFloatValue:catax];// Display result
- [Total setFloatValue:total];
-
- // Bring the cusor back to the Price field and select it.
- [Price selectText:self];
- }
-
-
- - (void)windowDidBecomeKey:(NSNotification *)notification;
- {
-
- // Brings the cursor to the field and selects text
- [Price selectText:self];
-
- }
-
-
- @end
-