Changing menu properties on the fly
You’ll often need to modify menu properties while a form is open and your application is running.
For example, you might want to change what menu items are offered based on the currently selected control. The following are two event handlers for the OnGotFocus and OnLostFocus properties of a grid object, respectively. When the grid gets focus, the previously defined Edit menu is enabled; when the grid loses focus, the menu is disabled.
function GridMenus // Assign to OnGotFocus of grid object
form.Root.Edit.Enabled = true
return
PROCEDURE NoGridMenus // Assign to OnLostFocus of grid object
form.Root.Edit.Enabled = false
return