How to Create UserDefined/Customized Menu in Menubar VSCode Windows - menubar

How to add customized menu and drop-down menus in the Menu bar. Currently we can add only in editor/title or Context Menus. Please suggest how we can define user define menu in VSCode UI.

Related

How to enable auto generation of Window MenuItems (e.g. Tile Window to Left/Right of Screen and Open file with checkmark) in macOS menubar

I am currently creating a macOS menubar for an app without using any interface builder (no XIB/NIB files), just pure code. However I was expecting some items to be auto-generated during the start-up of the app. Items like "Start Dictation", "Emoji & Symbols" under Edit menu were existing as well as the "Enter Full Screen" menu item under the View Menu. But when it comes to Window Menu nothing was automatically generated, only the menu items I've set in the code. Do I have to enable some flags or options when instantiating a Window NSMenu so it automatically generates those items? I am new to macOS development so I feel like I am kind of lost. Thanks in advance.
The Window and Help menus are a little special in that they have their own NSApplication properties, so you will need to set them to your menus so that the system will know what they are.
For example, if you just create a window menu and add it to the main, all you will get are the items that you have provided. If you also set it as the application’s windowsMenu, in addition you will get all the stuff for moving, tab support, etc.
Setting NSApp’s helpMenu is similar, where a Spotlight menu item is added to the menu.

Detect menu bar tracking

Is there a way to detect when tracking has started on the menu bar, including on menu extras? I have a window that I want to have behave like a menu, so it needs to be hidden when any other menu is displayed.

Display NSPopover above dock icon

How can I display an NSPopover above my app's dock icon?
There are two ways to customise the dock menu, based on if your application is running or not. See the Apple documentation for customising it when its open here:
http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/customizing_docktile/docktasks_cocoa/docktasks_cocoa.html#//apple_ref/doc/uid/TP30000986-CH3-SW1
To summarise, you basically provide a menu in the main application's XIB or storyboard which contains the extra menu options that you want to add to the dock menu.
To customise your Dock icon's menu when the application is not running, see the guide here:
http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/customizing_docktile/CreatingaDockTilePlug-in/CreatingaDockTilePlug-in.html
Basically, you need to create a plugin which you drop into your application's resource folder. This works very like the original method, but executes inside Finder's dock process.

Adding static items to "Windows" menu in Cocoa application

I have a application with 2 windows (think like Twitter Timeline and mentions). For now I have been having the menus "Timeline ⌘1" and "Mentions ⌘2" in the "File" menu but this is kind of wrong. So I moved them to the "Windows" menu just by drag and drop.
When I open the application everything is nice, I can see both menu items unter the "Windows" menu. But then when I close for example the Mentions window the menu Item "Mentions ⌘2" disappears and I am not able to open this window anymore.
I have had a look at other applications and most of them have their Menu items to show the windows in the "Windows" menu and they don't disappear either after closing the windows. I am aware of the fact that Cocoa does soma magic with the "Window" menu item and it is quite ok in doing so (because I open some other windows which need to appear and disappear from there), but how can I make those two items kind of static so they don't disappear?
I finally found an answer, in order for them to not be handled by the Windows menu you need to call
[timelineViewWindow setExcludedFromWindowsMenu:YES];
[mentionsViewWindow setExcludedFromWindowsMenu:YES];
and after that add the Menu items to the Windows menu and they will not disappear anymore.

Menu item doesn't show when creating menu in Interface Builder

In interface builder I added a menu item to the main menu. I can click on the menu and access its contents, however the title of the menu item doesn't show when running the program.
The image shows the application and its menu on top and on the bottom is the application as it appears in IB. Notice that where the menu in IB has the "Calculate" menu option, the running application has in its menu a space instead.
In the menu bar, there is an NSMenuItem which contains an NSMenu. Both have a "Title" property. In Interface Builder, what you see in the menu bar is the title of the NSMenuItem. In the application, what you see is the title of the NSMenu. If the NSMenu's title is not set, then you'll just see an empty string, which is what you've shown in your screenshot.
Click on the Menu item in Interface Builder so that the attached menu shows up. You can then set the title.
Note that in Interface Builder, if you drag a Menu Item to the menu bar, you get an NSMenuItem without any NSMenu attached. I suspect that's what you've done. You can drag a Menu on top of the NSMenuItem to add a menu to it, and then you can set the menu's title correctly. If instead of dragging a Menu Item, however, you drag a Submenu Item, then the attached NSMenu is already present, and it automatically updates the title when you change the text in the menu bar.

Resources