Re: Using new Class TDeepSeek for documenting
Posted: Fri Jan 17, 2025 11:07 pm
FWH Class TCheckbox documentation:
### Class Documentation: `TCheckBox`
#### Overview
The `TCheckBox` class is a subclass of `TControl` and represents a checkbox control in a FiveWin application. This class provides functionality to create, manage, and interact with checkbox controls, including handling user interactions, updating the checkbox state, and generating code for the checkbox.
#### Class Data (CLASSDATA)
- **`aProperties`**: An array of property names that define the attributes of the `TCheckBox` class. These properties include:
- `lChecked`: Indicates whether the checkbox is checked.
- `cVarName`: The variable name associated with the checkbox.
- `nClrText`: The text color of the checkbox.
- `nClrPane`: The background color of the checkbox.
- `nTop`: The top position of the checkbox.
- `nLeft`: The left position of the checkbox.
- `nWidth`: The width of the checkbox.
- `nHeight`: The height of the checkbox.
- `nAlign`: The alignment of the checkbox.
- `Cargo`: Additional data associated with the checkbox.
#### Methods
1. **`New( nRow, nCol, cCaption, bSetGet, oWnd, nWidth, nHeight, nHelpTopic, bChange, oFont, bValid, nClrFore, nClrBack, lDesign, lPixel, cMsg, lUpdate, bWhen, cVarName )`**
- **Description**: Constructor method for creating a new `TCheckBox` instance.
- **Parameters**:
- `nRow`, `nCol`: Position of the checkbox.
- `cCaption`: Text displayed next to the checkbox.
- `bSetGet`: Code block to get/set the checkbox state.
- `oWnd`: Parent window object.
- `nWidth`, `nHeight`: Dimensions of the checkbox.
- `nHelpTopic`: Help topic ID.
- `bChange`: Code block executed when the checkbox state changes.
- `oFont`: Font used for the checkbox text.
- `bValid`: Code block for validation.
- `nClrFore`, `nClrBack`: Foreground and background colors.
- `lDesign`: Indicates if the checkbox is in design mode.
- `lPixel`: Indicates if dimensions are in pixels.
- `cMsg`: Tooltip text.
- `lUpdate`: Indicates if the checkbox should update its state.
- `bWhen`: Code block executed before the checkbox is activated.
- `cVarName`: Variable name for the checkbox.
- **Returns**: Self (the `TCheckBox` instance).
2. **`ReDefine( nId, bSetGet, oWnd, nHelpId, bChange, bValid, nClrFore, nClrBack, cMsg, lUpdate, bWhen, cPrompt )`**
- **Description**: Redefines an existing checkbox control.
- **Parameters**:
- `nId`: Control ID.
- `bSetGet`: Code block to get/set the checkbox state.
- `oWnd`: Parent window object.
- `nHelpId`: Help topic ID.
- `bChange`: Code block executed when the checkbox state changes.
- `bValid`: Code block for validation.
- `nClrFore`, `nClrBack`: Foreground and background colors.
- `cMsg`: Tooltip text.
- `lUpdate`: Indicates if the checkbox should update its state.
- `bWhen`: Code block executed before the checkbox is activated.
- `cPrompt`: Text displayed next to the checkbox.
- **Returns**: Self (the `TCheckBox` instance).
3. **`Click()`**
- **Description**: Handles the click event of the checkbox. Toggles the checkbox state and executes the `bChange` code block if defined.
- **Returns**: `nil`.
4. **`Default()`**
- **Description**: Sets the default state of the checkbox and applies the font.
- **Returns**: `nil`.
5. **`cToChar()`**
- **Description**: Returns the control type as a string ("BUTTON").
- **Returns**: String ("BUTTON").
6. **`EraseBkGnd( hDC )`**
- **Description**: Handles the background erasure of the checkbox.
- **Parameters**:
- `hDC`: Handle to the device context.
- **Returns**: `1` if themed, otherwise calls the superclass method.
7. **`KeyChar( nKey, nFlags )`**
- **Description**: Handles key press events. Moves focus to the next control on `VK_RETURN`.
- **Parameters**:
- `nKey`: Key code.
- `nFlags`: Key flags.
- **Returns**: Result of the superclass method.
8. **`KeyDown( nKey, nFlags )`**
- **Description**: Handles key down events. Moves focus to the previous or next control on `VK_UP` or `VK_DOWN`.
- **Parameters**:
- `nKey`: Key code.
- `nFlags`: Key flags.
- **Returns**: Result of the superclass method.
9. **`LostFocus( hCtl )`**
- **Description**: Handles the loss of focus event.
- **Parameters**:
- `hCtl`: Handle to the control gaining focus.
- **Returns**: Result of the superclass method.
10. **`Initiate( hDlg )`**
- **Description**: Initializes the checkbox control within a dialog.
- **Parameters**:
- `hDlg`: Handle to the dialog.
- **Returns**: `nil`.
11. **`MouseMove( nRow, nCol, nKeyFlags )`**
- **Description**: Handles mouse movement over the checkbox.
- **Parameters**:
- `nRow`, `nCol`: Mouse position.
- `nKeyFlags`: Key flags.
- **Returns**: `nil`.
12. **`Refresh()`**
- **Description**: Refreshes the checkbox state based on the `bSetGet` code block.
- **Returns**: `nil`.
13. **`Reset()`**
- **Description**: Resets the checkbox state to its default value.
- **Returns**: `nil`.
14. **`GenLocals()`**
- **Description**: Generates local variable declarations for the checkbox.
- **Returns**: String containing local variable declarations.
15. **`cGenPrg()`**
- **Description**: Generates the source code for the checkbox control.
- **Returns**: String containing the generated code.
16. **`Check()`**
- **Description**: Checks the checkbox.
- **Returns**: `nil`.
17. **`UnCheck()`**
- **Description**: Unchecks the checkbox.
- **Returns**: `nil`.
18. **`SaveToRC( nIndent )`**
- **Description**: Generates the resource script (RC) entry for the checkbox.
- **Parameters**:
- `nIndent`: Indentation level.
- **Returns**: String containing the RC entry.
19. **`SetCheck( lOnOff )`**
- **Description**: Sets the checkbox state based on the boolean parameter.
- **Parameters**:
- `lOnOff`: Boolean indicating whether to check or uncheck the checkbox.
- **Returns**: `nil`.
20. **`SetText( cText )`**
- **Description**: Sets the text of the checkbox.
- **Parameters**:
- `cText`: Text to set.
- **Returns**: `nil`.
21. **`lChecked()`**
- **Description**: Returns the current state of the checkbox.
- **Returns**: Boolean indicating whether the checkbox is checked.
22. **`Html()`**
- **Description**: Generates HTML for the checkbox.
- **Returns**: HTML string.
23. **`Display()`**
- **Description**: Displays the checkbox by painting it.
- **Returns**: `0`.
24. **`Paint()`**
- **Description**: Paints the checkbox.
- **Returns**: `1`.
#### Additional Notes
- The `TCheckBox` class is designed to be used within FiveWin applications, providing a robust and flexible way to handle checkbox controls.
- The class includes methods for both runtime and design-time functionality, making it suitable for use in both application development and form design tools.
- The class leverages FiveWin's event handling and rendering capabilities to provide a seamless user experience.