Using new Class TDeepSeek for documenting
Posted: Fri Jan 17, 2025 10:33 pm
FWH Class TAutoGet documentation
### Class Documentation: `TAutoGet`
#### Overview
The `TAutoGet` class is a specialized version of the `TGet` class, designed to provide an auto-complete or drop-down list functionality for text input fields. It allows users to select from a list of predefined options as they type, enhancing user experience by reducing the need for manual input.
#### Inheritance
- **Parent Class**: `TGet`
- **Child Classes**: None
#### Data Members (Attributes)
1. **`aGradList`**
- **Type**: Custom (Array)
- **Description**: Stores gradient information for the list background.
2. **`aGradItem`**
- **Type**: Custom (Array)
- **Description**: Stores gradient information for individual items in the list.
3. **`nClrLine`**
- **Type**: Custom (Numeric)
- **Description**: Stores the color code for the line separating items in the list.
4. **`nClrText`**
- **Type**: Numeric
- **Description**: Stores the color code for the text in the list.
5. **`nClrSel`**
- **Type**: Numeric
- **Description**: Stores the color code for the selected item in the list.
6. **`uDataSource`**
- **Type**: Variant
- **Description**: Holds the data source for the list items (e.g., an array or hash).
7. **`uOrgData`**
- **Type**: Variant
- **Description**: Stores the original data source before any filtering or modification.
8. **`nDataType`**
- **Type**: Numeric
- **Description**: Indicates the type of data source (e.g., array, hash).
9. **`cField`**
- **Type**: Character
- **Description**: Specifies the field or key to be used from the data source.
10. **`oList`**
- **Type**: Object (TGetList)
- **Description**: Reference to the drop-down list object.
11. **`bCreateList`**
- **Type**: Block (Code Block)
- **Description**: Code block that defines how the list is created or filtered.
12. **`bCloseList`**
- **Type**: Block (Code Block)
- **Description**: Code block that defines actions to be taken when the list is closed.
13. **`nLHeight`**
- **Type**: Numeric
- **Description**: Specifies the height of the drop-down list.
#### Methods
1. **`New()`**
- **Description**: Constructor method for initializing a new `TAutoGet` object.
- **Parameters**:
- `nRow`, `nCol`: Position of the control.
- `bSetGet`: Code block for getting/setting the value.
- `oWnd`: Parent window.
- `nWidth`, `nHeight`: Dimensions of the control.
- `cPict`: Picture clause for formatting.
- `bValid`: Validation code block.
- `nClrFore`, `nClrBack`: Foreground and background colors.
- `oFont`: Font object.
- `lDesign`: Design mode flag.
- `oCursor`: Cursor object.
- `lPixel`: Pixel mode flag.
- `cMsg`: Tooltip message.
- `lUpdate`: Update flag.
- `bWhen`: Condition code block.
- `lCenter`, `lRight`: Alignment flags.
- `bChanged`: Change event code block.
- `lReadOnly`: Read-only flag.
- `lPassword`: Password mode flag.
- `lNoBorder`: Borderless flag.
- `nHelpId`: Help ID.
- `lSpinner`: Spinner flag.
- `bUp`, `bDown`, `bMin`, `bMax`: Code blocks for spinner actions.
- `bAction`: Action code block.
- `cBmpName`: Bitmap name.
- `cVarName`: Variable name.
- `cCueText`: Cue text.
- `uDataSrc`: Data source.
- `Flds`: Field or key to use.
- `nLHeight`: List height.
- `bCreateList`: Code block for creating the list.
- `aGradList`, `aGradItem`: Gradient information.
- `nClrLine`, `nClrText`, `nClrSel`: Color codes.
- **Returns**: Self (the initialized object).
2. **`ReDefine()`**
- **Description**: Re-defines an existing `TAutoGet` object with new properties.
- **Parameters**: Similar to `New()`.
- **Returns**: Self (the redefined object).
3. **`CloseList()`**
- **Description**: Closes the drop-down list.
- **Returns**: None.
4. **`CreateList()`**
- **Description**: Creates and displays the drop-down list.
- **Returns**: None.
5. **`KeyChar()`**
- **Description**: Handles key press events to open the list.
- **Parameters**: `nKey`, `nFlags`.
- **Returns**: None.
6. **`KeyDown()`**
- **Description**: Handles key down events for navigation within the list.
- **Parameters**: `nKey`, `nFlags`.
- **Returns**: Numeric (status code).
7. **`OpenList()`**
- **Description**: Opens the drop-down list based on user input.
- **Parameters**: `nKey`, `nFlags`.
- **Returns**: Numeric (status code).
8. **`LostFocus()`**
- **Description**: Handles the event when the control loses focus.
- **Parameters**: `hWndLost`.
- **Returns**: Result from the parent class's `LostFocus` method.
9. **`MouseWheel()`**
- **Description**: Handles mouse wheel events for scrolling the list.
- **Parameters**: `nKeys`, `nDelta`, `nXPos`, `nYPos`.
- **Returns**: None.
10. **`SetList()`**
- **Description**: Sets the data source and field for the list.
- **Parameters**: `uDataSource`, `cField`.
- **Returns**: None.
11. **`ValidList()`**
- **Description**: Checks if the list is valid and open.
- **Returns**: Logical (`.T.` if valid, `.F.` otherwise).
### Class Documentation: `TGetList`
#### Overview
The `TGetList` class is a helper class used by `TAutoGet` to manage the drop-down list. It handles the display, navigation, and selection of items in the list.
#### Inheritance
- **Parent Class**: `TControl`
- **Child Classes**: None
#### Data Members (Attributes)
1. **`aGradList`**
- **Type**: Custom (Array)
- **Description**: Stores gradient information for the list background.
2. **`aGradItem`**
- **Type**: Custom (Array)
- **Description**: Stores gradient information for individual items in the list.
3. **`nClrLine`**
- **Type**: Custom (Numeric)
- **Description**: Stores the color code for the line separating items in the list.
4. **`nClrText`**
- **Type**: Numeric
- **Description**: Stores the color code for the text in the list.
5. **`nClrSel`**
- **Type**: Numeric
- **Description**: Stores the color code for the selected item in the list.
6. **`uOrgValue`**
- **Type**: Variant
- **Description**: Stores the original value before any selection.
7. **`bKeyCount`**
- **Type**: Block (Code Block)
- **Description**: Code block that returns the number of items in the list.
8. **`bData`**
- **Type**: Block (Code Block)
- **Description**: Code block that retrieves data for a specific item.
9. **`lSBVisible`**
- **Type**: Logical
- **Description**: Indicates if the scrollbar is visible.
10. **`nDataType`**
- **Type**: Numeric
- **Description**: Indicates the type of data source (e.g., array, hash).
11. **`nRowHeight`**
- **Type**: Numeric
- **Description**: Height of each row in the list.
12. **`nMaxHeight`**
- **Type**: Numeric
- **Description**: Maximum height of the list.
13. **`oGet`**
- **Type**: Object (TAutoGet)
- **Description**: Reference to the parent `TAutoGet` object.
14. **`nFirstRow`**
- **Type**: Numeric
- **Description**: Index of the first visible row in the list.
15. **`nRecNo`**
- **Type**: Numeric
- **Description**: Current record number in the data source.
16. **`nRowAt`**
- **Type**: Numeric
- **Description**: Index of the currently selected row.
#### Methods
1. **`New()`**
- **Description**: Constructor method for initializing a new `TGetList` object.
- **Parameters**:
- `nTop`, `nLeft`: Position of the list.
- `oWnd`: Parent window.
- `nWidth`, `nHeight`: Dimensions of the list.
- `oGet`: Reference to the parent `TAutoGet` object.
- `aGradItem`, `aGradList`: Gradient information.
- `nClrLine`, `nClrText`, `nClrSel`: Color codes.
- **Returns**: Self (the initialized object).
2. **`Adjust()`**
- **Description**: Adjusts the size and position of the list.
- **Returns**: None.
3. **`KeyCount()`**
- **Description**: Returns the number of items in the list.
- **Returns**: Numeric (count of items).
4. **`Display()`**
- **Description**: Handles the display of the list.
- **Returns**: Numeric (status code).
5. **`EraseBkGnd()`**
- **Description**: Handles background erasure.
- **Returns**: Numeric (status code).
6. **`GetRowAt()`**
- **Description**: Returns the row index at a given position.
- **Parameters**: `nRow`.
- **Returns**: Numeric (row index).
7. **`GoDown()`**
- **Description**: Moves the selection down in the list.
- **Returns**: None.
8. **`GoUp()`**
- **Description**: Moves the selection up in the list.
- **Returns**: None.
9. **`HandleEvent()`**
- **Description**: Handles various events for the list.
- **Parameters**: `nMsg`, `nWParam`, `nLParam`.
- **Returns**: Result from the parent class's `HandleEvent` method.
10. **`LButtonUp()`**
- **Description**: Handles left mouse button up events.
- **Parameters**: `nRow`, `nCol`.
- **Returns**: None.
11. **`MouseLeave()`**
- **Description**: Handles mouse leave events.
- **Returns**: None.
12. **`MouseMove()`**
- **Description**: Handles mouse move events.
- **Parameters**: `nRow`, `nCol`, `nFlags`.
- **Returns**: Result from the parent class's `MouseMove` method.
13. **`Paint()`**
- **Description**: Handles the painting of the list.
- **Returns**: None.
14. **`PaintData()`**
- **Description**: Paints individual items in the list.
- **Parameters**: `hDC`, `nAtItem`.
- **Returns**: None.
15. **`SetList()`**
- **Description**: Sets the data source and field for the list.
- **Parameters**: `uDataSource`, `cField`.
- **Returns**: None.
16. **`RowCount()`**
- **Description**: Returns the number of visible rows in the list.
- **Returns**: Numeric (count of visible rows).
### Additional Functions
1. **`FontHeight()`**
- **Description**: Calculates the height of the font used in the list.
- **Parameters**: `oObj`, `oFont`.
- **Returns**: Numeric (font height).
2. **`IsRecordSet()`**
- **Description**: Checks if the given object is a recordset (unused in the provided code).
- **Parameters**: `o`.
- **Returns**: Logical (`.T.` if the object is a recordset, `.F.` otherwise).
### Summary
The `TAutoGet` and `TGetList` classes work together to provide a user-friendly auto-complete or drop-down list functionality. `TAutoGet` manages the input field and interactions, while `TGetList` handles the display and navigation of the list items. The classes are highly customizable, allowing for different data sources, colors, and gradients to be used.