See one or the other menu item

How can I view one menu from code and make the other invisible?

I have 2 submenus called A and B, if I display A, in submenu B must be

invisible and the opposite.

in Real Studio I call A.Visible = true, and B.visible = false, but in xojo it doesn’t work

I do not know any cross-platform way to achieve that. However, it should be quite easy on macOS.

Change the .text property to be “-”

According to the doc page for MenuItem.Visible, it does not work on Windows and you should use MenuItem.RemoveMenuAt instead.

If I remove the menu from code as you said, can I then always recreate another one from code or the same one ??

thank you

You can create a new menu item by cloning the first if the first one is a control array.
If you use the ‘set the text to -’ method, all you need do is change the text back.
While it is ‘-’ it looks like a separator line and is inactive