How to add main menu to application? - objective-c

I know that an application template comes with default 'Main Menu' items already existing and attached.
But if this default 'Main Menu' structure was deleted then how to re-add main menu items to the application? Simply adding fresh menu items tree to XIB and connecting it to the application's window 'menu' outlet using the visual connector does not make these menu items to appear in the application main menu - application menu bar still stays empty.
What is the right way to add menu to application?

Related

Asp.net Core web application (MVC) Adding a view from controller's action menu not working properly

I just created a brand new Asp.net Core Web Application (MVC) to reproduce a problem I have with another project.
When I try adding a view from the controller's action menu (right click > add a view) it creates a view within the Controller's folder instead of creating a new subfolder in the Views folder, naming it and placing the created view inside it.
My dotnet version is 3.1.401 and I am on Microsoft Visual Studio Community 2019 Version 16.7.2.
See underneath, the "index.cshtml" placed within the Controller folder. I am expecting a "Test" subfolder created in the Views folder and that "index.cshtml" view placed in it.
-- update :
The image underneath is to show where the view created from the controller's action menu (right click > add a view) ends up... Another precision, after I have created the folder manually and placed one view into it, any further views created with (right click > add a view) end up in the right folder automatically.
When you click the "Add View..." option to add view, perhaps you are select the "Razor View - Empty" template, screenshot as below:
After clicking the Add button, it will add a View page in the Controller folder.
To add a new view page in the subfolder under the Views folder, you could select the second item ("Razor View"):
Then, enter the view name and select model template:
After clicking the Add button, the view will add in the Views folder:
You are doing it in wrong way. In order to create a view for the specific Controller action you should go to you controller, put cursor in the name of desired action and click right button of a mouse. Then you will have an option to create a View for this action by clicking to Add View.
Look image below:

Is there a way to automatically change the selected menu page in a master detail project when the detail changes?

Background:
My project uses the "Master Detail" project from Xamarin.Forms, so it comes equipped with the hamburger menu button in the top left which is supposed to be the main source of navigation throughout the app. However, my app requires the user to go through multiple of those screens without the use of the hamburger menu. But when a user uses my own buttons to change the detail, the hamburger menu still says the user is on the previous page.
For example, a user is on Page A. They click a button outside of the menu which sends them to Page B. The menu will still show Page A.
My Attempt:
I really didn't know where to start, so I tried taking the MenuItemType and passing it through the following function:
// This changes the screen without changing the menu and it works.
((MasterDetailPage)Application.Current.MainPage).Detail = new NavigationPage(new PageB());
// This was my attempt to change the menu.
(Application.Current.MainPage as MenuPage).RootPage.NavigateFromMenu((id)MenuItemType.PageB);
But that returned a Null Reference Exception when run.
I've also tried manually calling the list view associated with the hamburger menu and changing the selectedItem property, but that didn't work either. Is there any way to change the selected menu?
For Clarity:
Since StackOverflow won't let me post a video, here's a link to how the app acts. As you can see, I use the Menu to go to the "About" Page. I click a button on the screen which takes me back to the "Browse" Page. However, when I open the menu, it still says "About" is selected. I can't reselect "About" until the menu moves away, meaning I have to reopen "Browse" despite already being on that screen.
What I'm looking for is a function which will automatically change the selected menu item to "Browse" when I press that button on the "About" Page. The app is currently using a Master Detail Page which has the "Detail" component changing from the About Page to the Browse Page. The menu page is a Content Page which came built with the app beforehand.

Menu strip of parented process not working

I have created a application in vb.net 2017. I am parenting another application made in vb.net 2017 to my main application's tab control.
When I am parenting notepad I can access its menu. But when I am parenting self made vb.net another application, Menu is showing but drop down is not showing.
Try to set the AllowDrop property of ContextMenuStrip to True

Working with Multiple Windows

In my MainMenu.xib, I have the main window of my app with web view, Now i have added a new window (with text field and button) in MainMenu.xib.
I have problem to add a menu tab where i click and my newly added window appears (Not on app Launching). How to connect menu tab item with window..???
Thanks in Advance
Would you like to do it without a single line of code?
i.e. Using Binding.
Here we go:
Create a secondary Window that you want to open on menu click.
Uncheck "Release when Close"
Create a new menu item : ctrl+drag from menu to window, select "makeKeyAndOrderFront"
That's it.

How to add a new Menu at the end of MenuBar?

One question is : Now I want to add a new Menu at the end of MenuBar, not to add a menuitem at the known menu. just like the Xcode Items: The last menu is Help , I want to add a new Mneu(MyMenu) behind the Help Menu ? How to do ? Thanks very much!
Generally, you should not add or remove items in the main menu at run time, because it breaks your users' muscle memory. Enable or disable them instead, and you'll have a much better UI.
Assuming you've found a good reason to do this, the way to do it is to get the main menu from the shared NSApplication object, then insert the menu item for your new menu. The menu item's submenu is the actual menu you're inserting. (Of course, you can create the menu and menu item in IB and access the menu item through an outlet.)