Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8004515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:56:29+00:00 2026-06-04T16:56:29+00:00

I have a NSAlert with a combobox in it and i need to know

  • 0

I have a NSAlert with a combobox in it and i need to know it’s value every time it changes.

In my .h i have implemented the NSComboBoxDelegate protocol and NSComboBox* comboBox.

In my .m i have:

[comboBox setDelegate:self];


- (void)comboBoxSelectionDidChange:(NSNotification *)notification{
    int x = [[comboBox stringValue] intValue];
    NSLog(@"ComboBox Value Changed to --> %i", x);
}

But here is the problem:
the default value of the combobox is 2. if i change the value to, for example, 6 my NSLog displays: ComboBox Value Changed to --> 2
Then, when i change it’s value back to 2, my NSLog displays: ComboBox Value Changed to --> 6
Any ideas about this problem?
Thank you.

PS: i have tried other NSComboBoxDelegate methods but it happens the same thing as i described above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:56:30+00:00Added an answer on June 4, 2026 at 4:56 pm

    Change the code to use objectValueOfSelectedItem instead of stringValue.

    - (void)comboBoxSelectionDidChange:(NSNotification *)notification{
        int x = [[notification.object objectValueOfSelectedItem] intValue];
        NSLog(@"ComboBox Value Changed to --> %i", x);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
I have a NSAlert Sheet that has a NSComboBox inside. How can i pass
Have I in some way delete this Task or it is self-destroyed? Task.Factory.StartNew(() =>
Have a linking (or ref) table which has a dual primary key. Need to
I need to show an NSAlert on the 3rd, 10th and 20th launch of
Is there a way to insert a custom icon in a NSAlert? I know
Have some runtime defined schedule for one week, for example: <schedule> <s day=Monday, time=1:00:00></s>
I am writing a Cocoa/Objective-C app in XCode4, and I need to know when
Have a recurring situation, petty I know, but I'd like to consolidate the following:
I've created the main window in my application to have these settings: [self setLevel:kCGDesktopWindowLevel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.