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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:13:41+00:00 2026-06-07T21:13:41+00:00

I have a menu item inside the main app menu and I’d like to

  • 0

I have a menu item inside the main app menu and I’d like to route its action to a view controller (NSViewController). The interface hierarchy looks like this: There’s a main app window controller by an NSWindowController. Inside the window there’s a split view, and the right view in the split view is controlled by the NSViewController.

Window + NSWindowController
    `-- NSSplitView
           `-- NSView
           `-- NSView + NSViewController

The menu item is connected to First Responder in the Interface Builder. The view controller in question implements the appropriate method, but the menu item stays disabled. When I move the method to the NSWindowController, the menu item gets enabled.

I figured I need to get the view controller to the responder chain, so I set it as the nextResponder for the window controller; no cigar. What am I doing wrong?

  • 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-07T21:13:43+00:00Added an answer on June 7, 2026 at 9:13 pm

    In the end I added a base class for my window controllers and made it forward calls to the “child” controllers:

    - (id) childControllerForSelector: (SEL) selector
    {
        for (id controller in [childControllers copy])
            if ([controller respondsToSelector:selector])
                return controller;
        return nil;
    }
    
    - (BOOL) respondsToSelector: (SEL) selector
    {
        return [super respondsToSelector:selector] ? YES :
            [self childControllerForSelector:selector] ? YES :
                NO;
    }
    
    - (void) forwardInvocation: (NSInvocation*) invocation
    {
        id child = [self childControllerForSelector:[invocation selector]];
        [invocation invokeWithTarget:child];
    }
    
    - (NSMethodSignature*) methodSignatureForSelector: (SEL) selector
    {
        NSMethodSignature *signature = [super methodSignatureForSelector:selector];
        if (!signature) {
            id child = [self childControllerForSelector:selector];
            signature = [child methodSignatureForSelector:selector];
        }
        return signature;
    }
    

    It’s a lot of code, but it’s a general solution that keeps the controller code free from ad-hoc forwarding. Hopefully it’s not too much magic.

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

Sidebar

Related Questions

I have a menu item Home in my main menu AND in my top
I have a main menu window. On clicking any menu item it opens a
Short: Is there a way to have a route-definition that will pass the CONTROLLER/ACTION
I have some submenu inserted as Window item submenu of Main Menu I have
Inside my control, I have: ContextMenu = new ContextMenu(); ContextMenu.MenuItems.Add(new MenuItem(&Add Item, onAddSpeaker)); ContextMenu.MenuItems.Add(new
I have a menu item to which I add another item. Now I want
I have a menu item which has children menu items. When one of the
I have a Menu page. If a user selects an Menu Item it opens
I've defined a custom content type - news. I also have a menu item
I have asp.net Menu Item <asp:MenuItem NavigateUrl= Text=Download Value=Download/> . When this item gets

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.