IsChecked - cCJAction

Function which indicates if an action should be checked

Type: Function

Return Data Type: Boolean

Parameters: None

Return Value

Returns True if item should be checked, False if not


Syntax
Function IsChecked Returns Boolean

Call: Get IsChecked to BooleanVariable


Description

IsChecked is a function that the developer should use to determine if an item should be checked or not. This is used by the Update method to set the object's pbChecked 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. Therefore, if you place the required logic inside of IsChecked to determine if an item is checked your menu items will always properly display this state.

By default IsChecked returns the value pbChecked, which means that, by default, it always returns the current state of the object.

Note:You should never change the value of pbChecked within IsChecked. The only purpose of IsChecked is to determine if the object should be checked and not if it is currently checked.


In this example, we assume that the message ToggleTabworkspace and the property pbTabWorkspace have been defined at the cCJCommandBarSystem object level (this is a hypothetical sample). Note that pbChecked is never explicitly set - it will be set as needed when Update is called.

Object oTabWorkSpaceMenu is a cCJMenuItem
    Set psCaption to "&Tab Workspace"
    Set psToolTip to "Tab Workspace"
    Set psDescription to  "Add or Remove the tab workspace"

    Procedure OnExecute  Variant vCommandBarControl
        Handle hoCommandBar 
        Get CommandBarSystemObject to hoCommandBar
        Send ToggleTabWorkspace of hoCommandBar
    End_Procedure

     Function IsChecked Returns Boolean
        Boolean bOn
        Handle hoCommandBar 
        Get CommandBarSystemObject to hoCommandBar
        Get pbTabWorkspace of hoCommandBar to bOn
        Function_Return bOn
     End_Function

End_Object

Active Updates

If 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 Also

IsEnabled | IsVisible | pbChecked | pbEnabled | pbVisible | Update