I'm a complete newbie to Objective-C, coming from a background of PHP, assorted dialects of BASIC, and a smattering of C/C++. While I feel I've got a fair handle on setting basic windows up in Interface Builder, however, I'm having trouble manipulating the content of text fields, especially calling values from them and sending values to them.
I'm using a basic Xcode Cocoa application template with no extras, and created a Cocoa class called "controller.h". In Interface Builder I put together a window with a Secure Text field, a basic NSTextField under it, and a Push Button to submit the form. My controller class is like so:
//controller.h
#import <Cocoa/Cocoa.h>
@interface controller {
IBOutlet id userInput;
IBOutlet id userOutput;
}
- (IBAction)submitButton:(id)sender;
@end
//controller.m
#import "controller.h"
@implementation controller
- (IBAction)submitButton:(id)sender {
NSBeep();
[userOutput setStringValue: userInput];
[userInput setStringValue:nil];
}
@end
I have userInput linked up to the Secure Text field, and userOutput linked to the NSTextField. submitButton is linked to the Push Button. Based on my understanding of how things work, this should assign the value of the secure text in userInput to userOutput, thereby updating what is displayed in the NSTextField, and then reset the field. The beep is there to let me know if the function is being called.
The beep isn't going off, however, which means that nothing is happening. Interface Builder built the files though, so I know that they've been defined properly and are connected to the proper places. How do I fix it so that the IBAction executes and the values are sent where they need to be?