• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: I'm somewhat new to Cocoa and I need some PopUpButton help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: I'm somewhat new to Cocoa and I need some PopUpButton help
      • From: Scott Anguish <email@hidden>
References: 
 >Re: I'm somewhat new to Cocoa and I need some PopUpButton help (From: "Jeffrey T. Hazelwood" <email@hidden>)

  • Prev by Date: Re: I'm somewhat new to Cocoa and I need some PopUpButton help
  • Next by Date: Re: Carbon Header Problem in my Cocoa App...
  • Previous by thread: Re: I'm somewhat new to Cocoa and I need some PopUpButton help
  • Next by thread: Re: I'm somewhat new to Cocoa and I need some PopUpButton help
  • Index(es):
    • Date
    • Thread