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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:27:13+00:00 2026-06-10T10:27:13+00:00

I had created an NSMenu via Interface Builder. One of the menu items called

  • 0

I had created an NSMenu via Interface Builder. One of the menu items called showPreferencesPanel method, which is defined in KBAppController.m:

-(void)showPreferencesPanel {
    //something
}

Now, I have to re-build the menu without IB…all programmatically. StatusMenu.m is the class that deals with all that, and I can’t figure out the target that I should set so that a method is called from another class.

Creating an instance of that class didn’t work! The menu item is grayed out.

StatusMenu.m

KBAppController *kbAppController = [[KBAppController alloc]init];
NSMenuItem* preferencesItem;
[preferencesItem setTarget:kbAppController];
preferencesItem = [[NSMenuItem alloc] initWithTitle:@"Preferences…" action:@selector(showPreferencesPanel) keyEquivalent:@""];

Edited:——————————————-

Here is the updated code that uses an object of class KBAppController. The good news is that the prefs menu item is enabled, but it still doesn’t call the method in KBAppController.m 🙁

KBStatusMenu.m

@synthesize kbAppController = _kbAppController;

someMethod {   
NSMenuItem* preferencesItem;
preferencesItem = [[NSMenuItem alloc] initWithTitle:@"Preferences…" action:@selector(showPreferencesPanel) keyEquivalent:@""];
[preferencesItem setTarget:self];
}

- (void)showPreferencesPanel {
NSLog(@"in 1");
[_kbAppController showPreferencesPanel];
}

KBAppController.m

-(void)showPreferencesPanel {
    NSLog(@"in 2");
    //something
}
  • 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-10T10:27:14+00:00Added an answer on June 10, 2026 at 10:27 am

    Have the selector call the method from your class. And inside that method, call showPreferencePanel() with the object of KBAPPController .

    Make sure to set the object of KBAppController as a property of StatusMenu.

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

Sidebar

Related Questions

I had created one div window which is draggable,and created one child div (with
I had created one HTML page for my experiance. In this i had use
i had created a class with two properties one of datetime datatype and other
I had created a web part on MOSS 2007 which displays a organizational chart
Hi am newbie to android development. I had created one application where i need
I am using MVVM architecture. I had created a user control which contains a
In school, one of my professors had created a 3D game (not just an
I had created one application with 2 versions one is paid second free. Now
I had created a class which create process using ProcessBuilder and then launch process
I had created a framework for a project in the past that one of

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.