This is Regular.m in view mode; [Download] [Up]
#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 [CATax setFloatValue:catax]; [Total setFloatValue:total]; // Bring the cusor back to the Price field and select it. [Price selectText:self]; } - (void)awakeFromNib { // This is one of the last methods executed after the nib file is loaded. // This is the Best way to initialize an object and jump into // a method after the nib file was loaded. // Brings the cursor to the field and selects text [Price selectText:self]; [[Price window] makeKeyAndOrderFront:self]; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.