How to Check Context Menu Dropdown Items, VB.NET? - vb.net

MY application has a context menu that appears when the user right-clicks a form. The context menu is generated on each click since the items depend on various application variables.
Each context menu contains a number of items and several DropDown sub-menus.
As the context menu is created, I can set items on the primary menu as checked as follows:
MenuItemX.Checked = True
However, I cannot find a way to make items in the Dropdown menu checked. I can create these items OK, but the line of code above does not allow me to set them as checked.
Is it possible to have items within a Dropdown sub-menu checked, and to set this property at run-time?
Can anyone provide an example of how to do this?

Related

Unable to add button to Custom List Item Ribbon

I am trying to add a Print Item button to the Forms (New, Edit, Display) of items in a Custom List. In order to achieve this I am using the following microsoft article https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/hh500259(v%3Doffice.14).
I follow the steps, however the Button is not displayed. Attaching Screenshots of how it is set on Sharepoint designer as reference
Do you have any ideas of what can be happening? Is there another way to add a print button the the Items Ribbon?
The button would not be added to the Items ribbon. In fact, the button is added to the drop down menu of the list item, as the below picture shows:

Hide/Unhide custom menu item under standard menu item based on transactions

I have a custom menu item created under system menu in the menu bar. I want the menu item to be displayed only in case of certain transactions.
The transactions are configured for my business scenario.
I tried the following:
1) Assigning a switch to the custom menu item under system menu in menu painter would hide/unhide it across all the transactions depending on whether the switch is active or not.
Also checked whether switch can be assigned set of transactions rather than a package. No luck.
2) Checked whether the code is hitting the statement set pf status. It's just hitting the set pf status for the other menu items like Goto and Edit. So don't know how exactly the system and help menu options are being populated. If I know exactly the working that is the common logic executed here, then I can possibly populate the custom menu item by reading the configuration of transactions.
3) Transaction variants is another option. But here too we do not have access to system and help menu options. Plus if it works, it would be not a generic solution as I will have to create transaction variant for all the transactions.

VB.NET Module-level variable to store count of child forms

In this exercise, you’ll create an application with a multiple-document interface that consists of a parent form and two child forms.
Open the project and add a parent form
1. Open the CalculateFlooringCosts project in the CalculateFlooringCostsMDI directory. Then, review the code for the Carpeting Costs and Hardwood Costs forms so you understand how they work.
Add a form to the project, and set the IsMdiContainer property of this form to True to identify it as the parent form. Resize the form so it’s large enough to hold several child forms, and use the Application page of the Project Designer to change the startup form to the new form.
Add the File menu to the parent form
Add a MenuStrip control to the parent form. Then, use the Menu Designer to add a File menu to the parent form. This menu should include four menu items that display a Carpeting Costs form, display a Hardwood Costs form, close the active child form, and exit from the application. Give each menu item an appropriate name, include access keys for the menu and menu items, and include a separator bar between the Close and Exit items.
Add an event handler for the Click event of each item in the File menu. The event handlers for the New Carpeting Costs and New Hardwood Costs items should create a new instance of the appropriate form, set the parent form to the current form, and display the form. The event handler for the Close item should close the active child form, if there is one. And the event handler for the Exit item should exit from the application.
Change the Exit buttons on the Carpeting Costs and Hardwood Costs forms to Close buttons, and change the StartPosition property of these forms to WindowsDefaultLocation.
Test the application to be sure that the items in the File menu work as expected.
Add the Window menu to the parent form
Add a Window menu to the right of the File menu. Then, add three items to this menu that will let the user arrange the forms in a cascaded, vertical, or horizontal layout.
Give each item in the Window menu an appropriate name, and then add an event handler for the Click event of each item that arranges the child forms appropriately.
Set the MdiWindowListItem property of the menu strip so the Window menu will display a list of the open child forms.
Test the application to be sure that the items in the Window menu work as expected.
Add a toolbar to the parent form
Add a ToolStrip control to the parent form. Then, add two buttons to this toolbar with the text “Carpeting Costs” and “Hardwood Costs” on them. Be sure to assign appropriate names to these buttons.
Add an event handler for the Click event of each button that uses the Click event handler for the associated menu to display the form.
Test the application to be sure that the toolbar buttons work.
Add a status bar to the parent form
Add a StatusStrip control to the parent form. Then, add a single ToolStripStatusLabel control to the status bar.
Add a module-level variable to the parent form to store the count of child forms, and give this variable an initial value of 0. Add code to increase or decrease the value of this variable each time a new form is opened or closed.
Add a procedure named DisplayFormCount that sets the Text property of the ToolStripStatusLabel control to “Number of child forms currently displayed: ” appended with the current form count. Then, add code to call this procedure when the form is loaded and each time the form count changes.
Test the application to be sure that the form count is displayed properly.
It's steps 15 and 16 I am stuck on.
I have tried this:
Private Sub DisplayFormCount(Sender As Object, e As EventArgs) Handles Me.MdiChildActivate
Dim activeForm As Form = Me.ActiveMdiChild
Me.sbMain.Items(0).Text = "Number of child forms currently displayed: " & Convert.ToString(Me.MdiChildren.Count)
End Sub
And it works for the most part. Upon form loading, it shows 0, then adding a form will make the count increase by 1. The problem is when I go to close the first child window, it doesn't subract. Afterwards all window closes reduces the count by 1 and when all windows are closed, it still says there's a count of 1.

what can an editor do with the "none" option for a menu item in the menu editor?

We are exploring the new menu editor that exists now in the channel manager of hippo version 7.9.1. We found the documentation at [1]. But we still have a question. A menu item can have an internal or external link, or have destination "none". We see that a hst:sitemenuitem is created with the property hst:repobased = false. What is the purpose of this destination type?
http://www.onehippo.org/library/concepts/component-development/enable-edit-menu-button-that-opens-menu-editor.html
The property hst:repobased is 'false' by default.
Menu items of type 'none' won't have a backing link. Such items can be useful in designs where some items are only used to visually group sub-items. For example, a site menu that is rendered as dropdowns (possibly nested) that expand on hover. The top-level items could have no backing page, but only serve as area that trigger the expansion of the sub-menu items.

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.)