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 9254361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:26:57+00:00 2026-06-18T11:26:57+00:00

I have an NSPopUpButton that I have subclassed that I plan to use in

  • 0

I have an NSPopUpButton that I have subclassed that I plan to use in multiple locations within my program. It’s subclassed because it has special functionality to it.

Normally to receive actions events, you create a method in the controller class and then connect it with interface builder to handle the action. For example if a user changed one of the options in the NSPopUpButton it would send a message to an interface builder action method such as below.

- (IBAction)sourcePopUpMenuChanged:(id)sender {
    NSLog(@"sourcePopUpMenuChanged");
}

This is fine in most cases, but in my case I want to have it send the message to the subclass it’s self and not the controller class. I want to do this because I am setting a global variable behind the scenes to keep track of the index for the popUpMenu, since the popupmenu appears in many different windows in my application.

I’m aware that I could just create IBAction events for every window for this control and manually set the global variable everytime but this seems inefficient.

Is there a way that if ANY INSTANCES of my control receive an ‘Action’ Message, that I can run some kind of code, for example, like set a global variable for gIndex = PopUpMenu Index Selected.

Help is much appreciated!

  • 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-18T11:26:58+00:00Added an answer on June 18, 2026 at 11:26 am

    To answer your question, you can override the method sendAction:to: on your NSPopUpButton subclass to do your stuff. Just don’t forget to call super so that the action message is forwarded to the regular receiver.

    When a control wants to send the configured action it uses the sendAction:to: method which calls sendAction:to:from: on NSApp (the single NSApplication instance). This method follows the responder chain to find the final recipient of the action message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of applications and I'd like to make an NSPopupButton that
The issue I have a popup button ( NSPopUpButton ) that is bound to
Have an app that can use tts to read text messages. It can also
I have a NSPopUpButton which contains a list of colors. In front of the
I have an NSMenu (belonging to an NSPopUpButton ) where the NSMenuItem all have
I have a list of elements which needs to be displayed in a NSPopUpButton.
Is it possible to set a default selection on an NSPopupButton? I have one
Have a chat room, issue is, is that when you submit something, the message
I have an NSPopUpButton inside a trackingArea. Now when I open the PopUp and
I'm exploring bindings right now, and have an NSPopUpButton - It presents me a

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.