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: Varun Mehta <email@hidden>
- Date: Sun, 16 Jun 2002 19:30:46 -0400
I'm looking at what you suggested, and it helps, but the change to the text
has to be made when the user changes the value of the PopUpButton, so the
text of the PopUpButton has to be the trigger for changing the text, not
just the basis of what the text becomes. I hope you understand what I mean.
:)
On 6/16/02 7:04 PM, "Jeffrey T. Hazelwood" <email@hidden> wrote:
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.