In the menu item, one can get and set some properties, e.g image, text, visible, enable etc. I would like to get the EventName linked to each item, can someone please advice?
If you have added the menubar and menuitems in the designer, then the EventName will be the same for all Items (whatever you set as the eventname for the menubar).
Ok, perhaps this is impossible. The main menu designer will be called MenuBar1 for example, you trap the sender events there and detect the tag/text property.
if each other menu item has an event, in your code there should be Sub menu123_Action for example, I had thought that perhaps just like .Enabled / .Visible when investigating menu items, one could get that property.
Example, the code below detects the menu and menuitem and uses the text property to make a menu visible/not. I assumed that perhaps one could get the .EventName property of the MenuItem - if possible.
B4X:
Sub MenuItemVisible(MBar As MenuBar, MainMenu As String, MenuItem As String, bVisible As Boolean)
Dim lMenus As List = MBar.menus
For Each strMenu As Menu In lMenus
Dim mText As String = strMenu.text
If mText.EqualsIgnoreCase(MainMenu) Then
For Each mi As MenuItem In strMenu.MenuItems
Dim miText As String = mi.Text
If miText.EqualsIgnoreCase(MenuItem) Then
mi.Visible = bVisible
Return
End If
Next
End If
Next
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.