Checkbox_Item_State - DfBaseList

Allows any item to become a checkbox-type item

Type: Property

Access: Read/Write

Data Type: Boolean

Parameters: Integer iItem

ParameterDescription
iItemThe item number


Syntax
 Property Boolean Checkbox_Item_State

Read Access: Get Checkbox_Item_State iItem to BooleanVariable
Write Access: Set Checkbox_Item_State iItem to BooleanVariable/Value


Description

Any item may become a checkbox-type item when its checkbox_item_state is set to true. The object's select_mode should be set to one of the modes other than no_select to allow users to select the choice that is desired.

The Select_State message should be used to let the checkbox show as marked/selected or not.

Default is false.

Sample code to create a grid with two columns and set the first column as a checkbox column:

Object oSelectGrid is a Grid
    Set CurrentCellColor to clYellow
    Set CurrentRowColor to clLime
    
    Set Size to 102 285
    Set Location to 5 5
    
    Set Resize_Column_state to FALSE
    Set Highlight_Row_state to TRUE
    
    Set Line_Width to 2 0
    Set Form_Width    0 to 15
    Set Header_Label  0 to ""
    Set Form_Width    1 to 262
    Set Header_Label  1 to "Bitmaps"
    
    Set Select_Mode To Multi_Select
    
    Procedure Activating
        Forward Send Activating
        Send DoLoadDirectory
    End_Procedure // DoLoadDirectory
    
    Procedure Select_Toggling Integer iItem Integer iState
        integer iColumns
        
        get Line_Size to iColumns
        if (iItem = Current) Begin
            Get Current_Item To iItem
        End
        If (Mod (iItem, iColumns) = 0) Begin
            Forward Send Select_Toggling iItem iState
        End
        Else Begin
            Forward Send Select_Toggling (Integer (iItem / iColumns) * iColumns) iState
        End
    End_Procedure // Select_Toggling
    
    Procedure DoLoadDirectory
        string sDirEntry
        integer iChannel
        
        move (Seq_New_Channel()) To iChannel
        if (iChannel >= 0) Begin
            Direct_Input Channel iChannel "DIR:C:\Program Files\DataFlex 11.0\Bitmaps\*.bmp"
            while (not(SeqEOF))
               Readln Channel iChannel sDirEntry
               If ( (Not(SeqEOF)) And (Left (sDirEntry, 1) <> "[")) Begin
                  Send Add_Item Msg_None ""
                  Set Checkbox_Item_State (Item_Count (Self) - 1) To True
                  Send Add_Item Msg_None sDirEntry
                  Set Entry_State (Item_Count (Self) - 1) To False
               End
            loop
            Close_Input Channel iChannel
            Send Seq_Release_Channel iChannel
        end
        
        Set Dynamic_Update_State To True
    End_Procedure // DoLoadDirectory

End_Object    // oSelectGrid