EnableMenuItems

I just noticed something kind of strange and wondering if someone else can verify.

Here is the setup.

Create a screen with a type of Movable Modal
Create a Method called Startup
In the Startup method put self.showmodal
Add a simple menu to it
In the EnableMenuItems - enable one of the menu items.
In the open event, put self.hide

Call the screen with wWindow.Startup()

The EnableMenuItems does not fire? I’ve traced it down to the self.hide, but why? Can’t enable the menu items even if you put code in the Startup event to enable them. If the Window type is Document, it works fine, but I just don’t get it.

What code did you use to attempt to enable one of the menu items?

And is there code in the menu handler?

Even implictily saying “menuitem.enabled=true” will NOT enable an empty handler.

Sorry guys, I thought it was obvious. I have a Close option on one of the menus that is enabled with FileClose.enabled = true.

Yes, it works fine as long as the self.hide is not in the Open event. With self.hide in the open.event, the menu item does not get enabled.

EnableMenuItems only fires when it needs to, normally just as you’re opening the top level menu. If the window isn’t visible, then why would EnableMenuItems need to fire? Which window winds up with focus? That’s where you need to enable the menu items.

Tim

Yes, I agree. However, when the self.showmodal fires in the Startup method, and the menu becomes visible, it still does not fire, even when you click on the menu. Again, if this is a Document window, then it does fire with the identical code.

Try putting the code in the APP.ENABLEMENUITEMS