Skip to content

pbChecked - cCJAction

Detrmines if an item is checked

Type: Property
Access: Read/Write
Data Type: Boolean
Parameters: None

Syntax

Property Boolean pbChecked
Access Type Syntax
Read Access: Get pbChecked to BooleanVariable
Write Access: Set pbChecked to BooleanVariable/Value

Description

pbChecked determines if an item is checked. This is typically used on checkbox menu items and toolbar items. When set to true, the item will appear with a checked appearance.

Default value is false.

Although this can be used to set the checked state of an item, you will normally only get the value of this property. Augmenting the IsChecked function and relying on the Update method is the preferred method for setting an item's checked state.

Samples

This will toggle the checked state of an item every time it is executed.

// not recommended
Procedure OnExecute
    Boolean bChecked
    Get pbChecked to bChecked
    Set pbChecked to (not(bChecked))
End_Procedure

This above sample is not realistic. An item's checked state is usually determined by the value of some external property. A method of coding this might be:

// still not recommended
Procedure OnExecute
    Boolean bChecked
    Get pbSomeExternalPropertyValue to bChecked
    Set pbSomeExternalPropertyValue  to (not(bChecked))
    Set pbChecked to (not(bChecked))
End_Procedure

The above is still not the best way to control an item's checked state. The IsChecked function provides an alternate way to determine if an item is checked. The following example shows the best way of controlling an item's checked state.

// recommended
Procedure OnExecute
    Boolean bChecked
    Get pbSomeExternalPropertyValue to bChecked
    Set pbSomeExternalPropertyValue  to (not(bChecked))
End_Procedure

Function IsChecked returns Boolean
    Boolean bChecked
    Get pbSomeExternalPropertyValue to bChecked
    Function_Return bChecked
End_function

See Also

IsChecked | Update | pbActiveUpdate