Sub Menu item in Commnandbar not updated

Hello People,

I have the following problem.

When I use a menu in the command bar and disable the functionality of the menu (.enable=FALSE) the menu is disabled. I also use this functionality in a sub item of the menu item (pull down menu appears) When I enable the functionality of the menu items only the item in the command bar is updated and not the sub item. (.enable=TRUE)

Figure indicates both items are disabled.

Figure indicates both items are enabled. (Note: only the item in the command bar is updated)

I?_Tll already tried update() and Refresh() but this does not solve the problem!

Thanks for the help.

Edwin Peeters

Sorry but I’m not sure that I understand your problem…Can you please share the part of your code that enables/disables the different menu items and point out which part of the code that doesn’t work as expected.

Thanks for the quick response,

If the robot is in automode it has to disable the menu’s, when it is in manual mode the 2 items must be enabled. The problem is that only the item in the commandbar (Tool) is enabled and the item (Stocklin I/O) stay’s disabled. Note: When I close the subitem (System) and open it again it is also enabeled!

Here it is :

If soAutoOn.Value = 1 Then

’ Robot in automatic mode

Me.Menu_Tool.Enabled = False

Me.Menu_Stocklin.Enabled = False

Else

’ Robot in manual mode

Me.Menu_Tool.Enabled = True

Me.Menu_Stocklin.Enabled = True

End If

Greetings,

Hi … are you running this code while the subitems list is opened?

Yes Carlos, you are right, when I close and open it again it’s enabled.

Greetings,

Edwin

Hi again,

The Enable property of the MenuItem forces to repaint its container only when it belongs to a CommandBar (consistent with the Menu_Tool). But, in the case of Menu_Stocklin, this MenuItem is attached to a MenuItem, not a CommandBar

The UI which displays the list of submenu only paints itself after it is opened and after you click on it. Maybe, as a work around, you could close the SubMenu and let the operator open it again (if needed).

BR

Small comment, not sure if it’s relevant or not :wink:

I follow your logic using C# and FlexPendant SDK 5.13 and the menu closes if it’s open when I run the code below.

private void cmdBoth_Click(object sender, EventArgs e)
{
if (menuItem3.Enabled == true && menuItem1.Enabled == true)
{
menuItem3.Enabled = false;
menuItem1.Enabled = false;
}
else
{
menuItem3.Enabled = true;
menuItem1.Enabled = true;
}
}

webwiz/151/EnableDisableMenuItem.zip