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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:32:23+00:00 2026-05-14T22:32:23+00:00

I would like three menu items on the menubar with the keyboard shortcuts cmd-1,

  • 0

I would like three menu items on the menubar with the keyboard shortcuts cmd-1, cmd-2, cmd-3. This I know how to do.

Each menu item would open up a different window (win1, win2, win3).

I want it so that only one instance of each window is permitted to be open at any one time (i.e. only one win1, one win2, etc).

How is this best approached?

  • 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-05-14T22:32:24+00:00Added an answer on May 14, 2026 at 10:32 pm

    If the windows in question are in the MainMenu.nib it’s simple; attach the action to -makeKeyAndOrderFront: on each window.

    If, on the other hand, they are not in MainMenu.nib, as is more likely the case if your application is structured in a sane fashion; things get a little more complicated. Long story short; you need to attach the menu item actions to appropriate methods on some manner of controller object (most likely your application delegate, although any controller that “sees” all the required nibs will do); and then have the controller in question send a similar message to its window.

    This is generally a sensible approach, as you can have smaller controller objects attached to your windows that also act, if appropriate, as data sources for the various views in the windows in question.

    It also allows for lazy loading of the windows, which is, at last count, a Good Thing™.

    If this is some manner of document-oriented (not necessarily document-based) application, and the windows display some attribute of the currently selected “document” or piece of data; subclassing NSWindowController and loading the window controllers in your MainMenu.nib is probably a good place to start.

    Note: If the objects responsible for controlling the windows live in the responder chain, they don’t even need to be referenced in MainMenu.nib; you can just attach the appropriately-named IBActions (e.g. openDetailsWindow: or the like) used to open the windows to the virtual FirstResponder object. (Simply add the selectors to its list of known methods, and you’re golden.)

    Reedit: To make the window not appear in the windows menu, you can call [window setExcludedFromWindowsMenu:YES].

    To check/uncheck the menu item is a bit tricker, as it requires your window controller actually knowing about the menu item; but as long as this is the case, it’s quite simple, again; call -setState:, with the relevant state names (NSOffState, NSOnState), for example from the delegate methods called when the window is shown/closed. (This could, again, be encapsulated “inside” the application delegate; if you for whatever reason don’t want your MainMenu.nib to contain the window controllers.)

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

Sidebar

Related Questions

In my toplevel menu items, I would like to make a subline for each
I would really like to stop the menu items jumping around on this site
I would like to know if there are any templates for doing this in
I would like to be able to completely remove menu items upon startup of
On Linux would like to have a set of menu items which are mutually
I would like to have a menu item without children. I have a QMenubar,
I am creating a menu in Android and I would like this menu to
I would like to know how it is possible to customize a NSMenu items
I would like to create an iphone application that displays three rows of infinite
I have three jobs that I would like to serialize in Jenkins. They should

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.