I started from scratch to make a new popupbutton program. Below is the code.
#import <Cocoa/Cocoa.h>
@interface firsttrypopupasm : NSObject {
IBOutlet NSTextField*output;
IBOutlet NSPopUpButton*adamPopUp;
}
-(IBAction)adamPopUpNSPopUpButton*)sender;
@end
#import "firsttrypopupasm.h"
@implementation firsttrypopupasm
-(IBAction)adamPopUpNSPopUpButton*)sender;
{
adamPopUp=[[NSPopUpButton alloc]initWithFrame:NSMakeRect(0.0, 00.0, 75.0, 14.0) pullsDown:NO];
[adamPopUp addItemsWithTitles:[NSArray arrayWtihObjects"show one",@"show two",@"show three",nil]];
if ([[adamPopUp selectedItem] isEqualToString"show one"])
[output setStringValue"one"];
if ([[adamPopUp selectedItem] isEqualToString"show two"])
[output setStringValue"two"];
if ([[adamPopUp selectedItem] isEqualToString"show three"])
[output setStringValue"three"];
}
@end
The idea with this program is that you have a popupbutton, with three elements, and a text field. When you scroll between elements in the popupbutton -- show one, show two, show three -- one, two, and three appear in the textfield. The program runs without errors, but when it is run, when scrolling between elements in the popupbutton, nothing shows up in the textfield. Appreciate any ideas. Thanks.
Adam
#import <Cocoa/Cocoa.h>
@interface firsttrypopupasm : NSObject {
IBOutlet NSTextField*output;
IBOutlet NSPopUpButton*adamPopUp;
}
-(IBAction)adamPopUpNSPopUpButton*)sender;
@end
#import "firsttrypopupasm.h"
@implementation firsttrypopupasm
-(IBAction)adamPopUpNSPopUpButton*)sender;
{
adamPopUp=[[NSPopUpButton alloc]initWithFrame:NSMakeRect(0.0, 00.0, 75.0, 14.0) pullsDown:NO];
[adamPopUp addItemsWithTitles:[NSArray arrayWtihObjects"show one",@"show two",@"show three",nil]];
if ([[adamPopUp selectedItem] isEqualToString"show one"])
[output setStringValue"one"];
if ([[adamPopUp selectedItem] isEqualToString"show two"])
[output setStringValue"two"];
if ([[adamPopUp selectedItem] isEqualToString"show three"])
[output setStringValue"three"];
}
@end
The idea with this program is that you have a popupbutton, with three elements, and a text field. When you scroll between elements in the popupbutton -- show one, show two, show three -- one, two, and three appear in the textfield. The program runs without errors, but when it is run, when scrolling between elements in the popupbutton, nothing shows up in the textfield. Appreciate any ideas. Thanks.
Adam