Defining a Menu Update Policy
To define a menu update policy in your application, you need to do the following:
-
Decide what status flags your application needs.
For example, the Layout editor defines the following flags:
The status flags must be powers of two so that each corresponds to one bit in the status number.layoutIsEditable = 2 layoutIsModified = 4 shapeIsSelected = 8 -
Set the enable predicate on one or more menus items. The enable predicate is a bit mask. The bitmask is formed by combining the status flags using the bitwise OR operator.
For example, thecreateShapeMenuand thedeselectAllMenuenable predicates are set as follows:geSetEnablePredicate(createShapeMenu "LayoutApp" layoutIsEditable)
geSetEnablePredicate(deselectAllMenu "LayoutApp" shapeIsSelected)
You must pass the menu object, not the menu’s symbolic name, togeSetEnablePredicate. -
Use
geSetWindowStatusto set the current status whenever your application’s status changes. The Virtuoso tool enables or disables your menus according to the policy you define.currentStatus = geGetWindowStatus(windowId "LayoutApp")
currentStatus = if(cellview~>modifiedButNotSaved then currentStatus | layoutIsModified else curre
ntStatus & ~layoutIsModified )
geSetWindowStatus(windowId "LayoutApp" currentStatus)
Related Topics
Automatic Menu Enabling Functions
Return to top