IsVisible - cCJAction

Function which indicates if an action should be visible

Type: Function

Return Data Type: Boolean

Parameters: None

Return Value

Returns True if item should be visible, False if not


Syntax
Function IsVisible Returns Boolean

Call: Get IsVisible to BooleanVariable


Description

IsVisible is a function that the developer should use to determine if an item should be visible or not. This is used by the Update method to set the object's pbVisible 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 IsVisible to determine if an item is visible your menu items will always properly display this state.

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

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


In this example, we assume that the property pbReadOnly has been defined at the cCJCommandBarSystem object level (this is a hypothetical sample). When the value of pbReadOnly is changed, this menu item should either appear or be hidden. Note that pbVisible is never explicitly set - it will be set as needed when Update is called.

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

    Procedure OnExecute  Variant vCommandBarControl
        Send SaveMe
    End_Procedure

     Function IsVisible Returns Boolean
        Boolean bReadOnly
        Handle hoCommandBar 
        Get CommandBarSystemObject to hoCommandBar
        Get pbReadOnly of hoCommandBar to bReadOnly
        Function_Return (not(bReadOnly))
     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 | IsChecked | pbChecked | pbEnabled | pbVisible | Update