Re: I'm somewhat new to Cocoa and I need some PopUpButton help
Re: I'm somewhat new to Cocoa and I need some PopUpButton help
- Subject: Re: I'm somewhat new to Cocoa and I need some PopUpButton help
- From: "Jeffrey T. Hazelwood" <email@hidden>
- Date: Sun, 16 Jun 2002 19:04:37 -0400
Sure, something like this will do the trick...
Define some variables in your header file:
IBOutlet id textField;
NSPopUpButton *yourPopUpButton;
then make some action like this:
- (IBAction)changeTextField:(id)sender
{
int popUpValue;
popUpValue = [[yourPopUpButton selectedItem] tag];
switch (popUpValue) {
case 0:
[textField setStringValue:@"You selected X "];
// you could change more textfield values here too
break;
case 1:
[textField setStringValue:@"You selected Y "];
// you could change more textfield values here too
break;
}
}
Just make sure to give your popupbutton values
a tag number first value 0, second 1, third, 2, etc....in interface
builder
On Sunday, June 16, 2002, at 05:36 PM, Varun Mehta wrote:
I'm creating a program and I need an NSPopUpButton to be able to change
the
values of certain NSTextFields when the user chooses something else
from the
NSPopUpButton, but I don't see how this is possible. Does anyone have
any
suggestions on how I can accomplish this?
Thanks,
Varun Mehta
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.