Returns True if item should be enabled, False if not
Function IsEnabled Returns Boolean
| Call: | Get IsEnabled to BooleanVariable |
IsEnabled is a function that the developer should use to determine if an item should be enabled or not. This is used by the Update method to set the object's pbEnabled state. Update is called before a popup menu item is displayed, during an idle timer update (if pbActiveUpdate is true) and at the end of the Execute method. In addition, if IsEnabled is false, the OnExecute event will not be sent. Therefore, if you place the required logic inside of IsEnabled to determine if an item is enabled your menu items will always properly display this state.
By default IsEnabled returns the value pbEnabled, which means that by default it always returns the current state of the object.
| Note: | You should never change the value of pbEnabled within IsEnabled. The only purpose of IsEnabled is to determine if the object should be enabled and not if it is currently enabled. |
Object oReadOnlyMenu is a cCJMenuItem
Set psCaption to "&Read Only"
Set psToolTip to "Read Only"
Set psDescription to "Set or Clear system read only status"
Procedure OnExecute Variant vCommandBarControl
Handle hoCommandBar
Get CommandBarSystemObject to hoCommandBar
Send ToggleReadOnly of hoCommandBar
End_Procedure
Function IsEnabled Returns Boolean
Boolean bReadOnly
Handle hoCommandBar
Get CommandBarSystemObject to hoCommandBar
Get pbReadOnly of hoCommandBar to bReadOnly
Function_Return (Not(bReadOnly))
End_Function
End_ObjectIf this item was used in a popup menu, there would be no need to set pbActiveUpdate to true. Update is sent to this item before it is popped up and therefore it will always be correct. If this item were used in a toolbar, setting pbActiveUpdate to true ensures that this will refreshed via the idle timer (if pbTimerUpdate is true) and will always reflect the latest changes.
See AlsoIsChecked | IsVisible | pbChecked | pbEnabled | pbVisible | Update