Page 1 of 1

Using Dynamically Created Menus

Posted: Wed Sep 28, 2016 7:40 am
by caseywhite
I have created a push button that has a popup menu that has dynamically created menu items and also a dynamically created submenu.

There are some things I can do so as a test I set up something similar that doesn't use dynamic creation to verify it has nothing to do with building the menu system dynamically. Here are my issues.

1. I want to allow the user to click on a menu item that has a submenu and have it handle the click event instead of showing the submenu. The submenu will only appear if you hover. This doesn't appear to work. Is there a work around to this or a property I can set to make this functionality available.

2. It seems like you have to set the height of the popup menu because LANSA doesn't automatically size the popup menu to fit all the menu items. The propery MenuSizing is available but it won't let me select Popup. It just goes back to None. I tried setting the Size to Content Width and Height. The height got sized correctly, but it makes the width too small. So I supposed the answer is to just set the appropriate width and then set the size to Content Height. Any thoughts?

Re: Using Dynamically Created Menus

Posted: Wed Sep 28, 2016 8:46 am
by Stewart Marshall
Hi Casey

1 - Once a submenu has been attached to a menuitem, the click event is used to show the submenu. As far as I'm aware, there's no way around this without manually coding the appearance of the submenu using the MouseHover event.

It does seem like a slightly odd requirement though. Typically, the first item on the submenu is used in place of the item with the submenu.

2 - MenuSizing is the property you want but it appears to be a bug in SP1. I've tried it in the latest build and it's working as expected, so it will be fixed in the upcoming EPC. For now, you'll have to set the height of the popup in code.

Regards

Re: Using Dynamically Created Menus

Posted: Wed Sep 28, 2016 9:06 am
by caseywhite
Thanks Stewart.

Makes sense on #1. Go to know that #2 will work with the next EPC.