MenuItem.visible not working when default setting is False

I have a (Mac only) MyMenuItem that I have set default visibility to False in the IDE.
The MyMenuItem is subclassed from the AppleMenuItem so it appears under the App menu

When certain conditions are met, I want the menuItem to become visible.

MyMenuItem.visible = true

But it doesn’t work - nothing shows up.

However, if I set the visibility to True in the IDE, then set it to False on, then once the conditions are met MyMenuItem.Visible = True works.

Is this a bug, or some special behaviour of AppleMenuItem?

I realise this is bit obscure, but no replies?

Maybe I didn’t phrase it well.

Make any menu item
Set it as an AppleMenuItem.
Set its visibility to False in the Xojo interface.
Now you can’t programatically make it visible again. Why?

I often remove certain menu items in the open event between web and MAS versions, but I never make them visible again. Surely if you want to just disable them instead, if they’re ever going to be re-enabled, rather than remove them.

Same here, I am removing a menuitem from a Windows version, keeping it for the MAS version.

menuitem.enabled = false is just greyed out but still visible
menuitem.visible = false makes it gone

I think this (unable to make menuitem visible programatically) is a bug, unless there is a special behaviour of AppleMenuItem that is not documented.

I confirm what you wrote with Xojo 2015r1.

Note: I forgot to set its super to AppleMenuItem. I put a new entry in the File Menu, and there it worked: at run time, the untitled entry is visible at run time.

I set the Menu visibility to True in Window1.Open.

Think at writing a Feedback buck report.

Totally untested but is this one of those “be sure you’re using the EnableMenuItems event, that’s why it exists” things?

I did verify that an ApplicationMenuItem set as invisible in the IDE remains so even when the property is changed. It may have to do with the special nature of the Application menuItem. At any rate the workaround is fairly simple : leave it as visible, and switch in Open according to needs.

A bug report seems in order.

If an AppleMenuItem menu item is set to not visible in the IDE, it is not added at all to the menu (not even at the location it is placed in the menu editor for Windows). I think this started when Apple forbid to re-use menu items in different places (in Xojo you get a MenuParentException in such a case). Me too thinks this is a bug: the AppleMenuItem should be created on OS X and then set to be invisible after its creation.