Below is the code for a simple program that inputs an integer in one textbox, then outputs it in another when a button is pushed. It works OK.
#import <Cocoa/Cocoa.h>
@interface fourthtryasm : NSObject {
IBOutlet NSTextField*input;
IBOutlet NSTextField*output;
}
-(IBAction)asmbuttonNSButton*)sender;
@end
#import "fourthtryasm.h"
@implementation fourthtryasm
-(IBAction)asmbuttonNSButton*)sender;
{
NSInteger integer=[input intValue];
[output setIntValue:integer];
}
@end
What I really wanted to do was to have 5 added to the inputted number when it was put in the second text box. I tried various things. The first attempt was the following --
[output setIntValue:[integer+5]];
The second was something like this--
[output setIntValue:[[integer+5] intValue]]
None of these worked, of course. Can someone tell me how to get this to work, and then let me know what ?class methods I should use to do arithmetic. Thanks.
Adam
#import <Cocoa/Cocoa.h>
@interface fourthtryasm : NSObject {
IBOutlet NSTextField*input;
IBOutlet NSTextField*output;
}
-(IBAction)asmbuttonNSButton*)sender;
@end
#import "fourthtryasm.h"
@implementation fourthtryasm
-(IBAction)asmbuttonNSButton*)sender;
{
NSInteger integer=[input intValue];
[output setIntValue:integer];
}
@end
What I really wanted to do was to have 5 added to the inputted number when it was put in the second text box. I tried various things. The first attempt was the following --
[output setIntValue:[integer+5]];
The second was something like this--
[output setIntValue:[[integer+5] intValue]]
None of these worked, of course. Can someone tell me how to get this to work, and then let me know what ?class methods I should use to do arithmetic. Thanks.
Adam