any way to display menuitem programmatically?

Hi All,

I was trying to show/invoke a menu item programmatically based on certain conditions in the code without requiring user interaction to display the menu. I tried menuItem.setVisible(true) but this doesn’t actually display the menuitem. Any tips? If this is suppose to do what I am expecting, I can look into my situation again.

Thanks.

Do you want to open a menu and highlight an item in it to “show it to the user” (wait for the user to press it)? Or do you just want the action behind this menu item to be performed?

In the latter case you just need to refactor your code so that activating the menu item calls a method that you can call from other places as well.

Unfortunately I don’t think there is any way to programmatically open a menu (I’m guessing this is MenuBar?).

HTH,
/Jonatan

Hi Jonatan,

I want to, “open a menu and highlight an item in it to “show it to the user” (wait for the user to press it).” :slight_smile: As you stated the later case is do-able pretty easily.

Thanks!

I’m sorry, but the MenuBar currently has no such functionality. You can file a feature request ticket at
dev.vaadin.com
if you like.

/Jonatan