Using new Class TDeepSeek for documenting

User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Using new Class TDeepSeek for documenting

Post by Antonio Linares »

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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TActiveX documentation:
### Class Documentation: `TActiveX`

#### Overview
The `TActiveX` class is part of the FiveWin library, designed to support ActiveX controls in Windows applications. It provides a framework for embedding and interacting with ActiveX controls within a FiveWin application. The class handles the creation, management, and interaction with ActiveX controls, including property access, method invocation, and event handling.

#### Class Hierarchy
- **Parent Class**: `TControl`
- **Child Classes**: `THActiveX`

#### Class Data Members (CLASSDATA)
- **`lRegistered`**: A logical flag indicating whether the ActiveX control has been registered.

#### Data Members (DATA)
- **`hActiveX`**: Handle to the ActiveX control.
- **`cProgID`**: The ProgID (Programmatic Identifier) of the ActiveX control.
- **`cString`**: A string representation of the ActiveX control's CLSID (Class Identifier).
- **`aProperties`**: An array holding the properties of the ActiveX control.
- **`aMethods`**: An array holding the methods of the ActiveX control.
- **`aEvents`**: An array holding the events of the ActiveX control.
- **`bOnEvent`**: A code block that is executed when an event is triggered.
- **`oOleAuto`**: An instance of `TOleAuto`, used for OLE automation.

#### Methods (METHODS)
- **`New( oWnd, cProgID, nRow, nCol, nWidth, nHeight )`**: Constructor method for creating a new instance of `TActiveX`. It initializes the control with the specified ProgID, position, and dimensions.
- **Parameters**:
- `oWnd`: The parent window.
- `cProgID`: The ProgID of the ActiveX control.
- `nRow`, `nCol`: The position of the control.
- `nWidth`, `nHeight`: The size of the control.
- **Returns**: Self.

- **`ReDefine( nId, oWnd, cProgID )`**: Constructor method for redefining an existing ActiveX control.
- **Parameters**:
- `nId`: The control ID.
- `oWnd`: The parent window.
- `cProgID`: The ProgID of the ActiveX control.
- **Returns**: Self.

- **`Do( ... )`**: Invokes a method on the ActiveX control.
- **Parameters**: Variable arguments depending on the method being invoked.
- **Returns**: The result of the method invocation.

- **`Display()`**: Displays the ActiveX control by calling `BeginPaint()`, `Paint()`, and `EndPaint()`.
- **Returns**: 0.

- **`EraseBkGnd()`**: Handles the background erasure of the control.
- **Returns**: 1.

- **`GetProp( cPropName )`**: Retrieves a property value from the ActiveX control.
- **Parameters**:
- `cPropName`: The name of the property to retrieve.
- **Returns**: The value of the property.

- **`Initiate( hDlg )`**: Initializes the ActiveX control within a dialog.
- **Parameters**:
- `hDlg`: Handle to the dialog.
- **Returns**: `nil`.

- **`OnEvent( nEvent, aParams, pParams )`**: Handles events triggered by the ActiveX control.
- **Parameters**:
- `nEvent`: The event ID.
- `aParams`: An array of parameters associated with the event.
- `pParams`: Additional parameters.
- **Returns**: `nil`.

- **`ReadTypes()`**: Reads the type information (properties, methods, events) of the ActiveX control from the registry.
- **Returns**: `nil`.

- **`ReSize( nFlags, nWidth, nHeight )`**: Resizes the ActiveX control.
- **Parameters**:
- `nFlags`: Resize flags.
- `nWidth`: New width.
- `nHeight`: New height.
- **Returns**: The result of `ActXSetLocation`.

- **`SetProp( cPropName, uParam1 )`**: Sets a property value on the ActiveX control.
- **Parameters**:
- `cPropName`: The name of the property to set.
- `uParam1`: The value to set.
- **Returns**: The result of the property setting.

- **`Destroy()`**: Destroys the ActiveX control and releases resources.
- **Returns**: The result of the parent class's `Destroy` method.

- **`OnError( ... )`**: Error handler for method calls on the ActiveX control.
- **Parameters**: Variable arguments depending on the error.
- **Returns**: The result of the error handling.

### Class Documentation: `THActiveX`

#### Overview
The `THActiveX` class is a specialized version of `TActiveX` designed to handle ActiveX controls in a more advanced manner, particularly for 64-bit environments. It extends the functionality of `TActiveX` with additional methods and properties.

#### Class Data Members (CLASSDATA)
- **`lRegistered`**: A logical flag indicating whether the ActiveX control has been registered.

#### Data Members (DATA)
- **`oOleAuto`**: An instance of `TOleAuto`, used for OLE automation.
- **`hWndPtr`**: Pointer to the window handle of the ActiveX control.
- **`cProgID`**: The ProgID of the ActiveX control.
- **`cString`**: A string representation of the ActiveX control's CLSID.
- **`bOnEvent`**: A code block that is executed when an event is triggered.
- **`aProperties`**: An array holding the properties of the ActiveX control.
- **`aMethods`**: An array holding the methods of the ActiveX control.
- **`aEvents`**: An array holding the events of the ActiveX control.

#### Methods (METHODS)
- **`New( oWnd, cProgID, nRow, nCol, nWidth, nHeight )`**: Constructor method for creating a new instance of `THActiveX`.
- **Parameters**:
- `oWnd`: The parent window.
- `cProgID`: The ProgID of the ActiveX control.
- `nRow`, `nCol`: The position of the control.
- `nWidth`, `nHeight`: The size of the control.
- **Returns**: Self.

- **`Init( hWnd, cProgId, nTop, nLeft, nWidth, nHeight )`**: Initializes the ActiveX control.
- **Parameters**:
- `hWnd`: Handle to the window.
- `cProgId`: The ProgID of the ActiveX control.
- `nTop`, `nLeft`: The position of the control.
- `nWidth`, `nHeight`: The size of the control.
- **Returns**: Self.

- **`Initiate( hDlg )`**: Initializes the ActiveX control within a dialog.
- **Parameters**:
- `hDlg`: Handle to the dialog.
- **Returns**: `nil`.

- **`ReDefine( nId, oWnd, cProgID )`**: Constructor method for redefining an existing ActiveX control.
- **Parameters**:
- `nId`: The control ID.
- `oWnd`: The parent window.
- `cProgID`: The ProgID of the ActiveX control.
- **Returns**: Self.

- **`cToChar()`**: Converts the control to a character representation.
- **Returns**: The string "AtlAxWin".

- **`Do( ... )`**: Invokes a method on the ActiveX control.
- **Parameters**: Variable arguments depending on the method being invoked.
- **Returns**: The result of the method invocation.

- **`Event( ... )`**: Handles events triggered by the ActiveX control.
- **Parameters**: Variable arguments depending on the event.
- **Returns**: `nil`.

- **`OnError()`**: Error handler for method calls on the ActiveX control.
- **Returns**: The result of the error handling.

- **`Destroy()`**: Destroys the ActiveX control and releases resources.
- **Returns**: The result of the parent class's `Destroy` method.

- **`ReadTypes()`**: Reads the type information (properties, methods, events) of the ActiveX control from the registry.
- **Returns**: `nil`.

### Summary
The `TActiveX` and `THActiveX` classes provide a robust framework for embedding and interacting with ActiveX controls in FiveWin applications. They handle the creation, management, and interaction with ActiveX controls, including property access, method invocation, and event handling. The classes are designed to work seamlessly in both 32-bit and 64-bit environments, making them versatile tools for Windows application development.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBar documentation:
### Class Documentation: `TBar`

#### Overview
The `TBar` class is a custom control class in the FiveWin framework, designed to create and manage button bars. These button bars can be positioned at the top, bottom, left, or right of a window, or they can be floating. The class provides functionality to add, remove, and manage buttons and groups of buttons, as well as to customize the appearance and behavior of the button bar.

#### Data Members (DATA)

1. **`nGroups`**:
- **Type**: Numeric
- **Description**: Stores the number of groups in the button bar.

2. **`nMode`**:
- **Type**: Numeric
- **Description**: Indicates the current mode of the button bar (e.g., TOP, LEFT, RIGHT, BOTTOM, FLOAT).

3. **`nBtnWidth`**:
- **Type**: Numeric
- **Description**: Width of the buttons in the button bar.

4. **`nBtnHeight`**:
- **Type**: Numeric
- **Description**: Height of the buttons in the button bar.

5. **`aBmpRect`**:
- **Type**: Array
- **Description**: Stores the rectangle coordinates for bitmap buttons.

6. **`l3D`**:
- **Type**: Logical
- **Description**: Indicates whether the button bar has a 3D appearance.

7. **`l97Look`**:
- **Type**: Logical
- **Description**: Indicates whether the button bar should have a Windows 97-style look.

8. **`l2007`, `l2010`, `l2013`, `l2015`**:
- **Type**: Logical
- **Description**: Flags to indicate if the button bar should have the appearance of Office 2007, 2010, 2013, or 2015.

9. **`lLegacyLook`**:
- **Type**: Logical
- **Description**: Indicates whether the button bar should use a legacy look.

10. **`bClrGrad`**:
- **Type**: Codeblock
- **Description**: Codeblock that defines the gradient colors for the button bar.

11. **`bColorMap`**:
- **Type**: Codeblock
- **Description**: Codeblock that defines the color mapping for the button bar.

12. **`nGroupSep`**:
- **Type**: Numeric
- **Description**: Separation between groups of buttons.

13. **`lBorder`**:
- **Type**: Logical
- **Description**: Indicates whether the button bar has a border.

14. **`lGDIP`**:
- **Type**: Logical
- **Description**: Indicates whether GDI+ is used for rendering.

15. **`oGrpFont`**:
- **Type**: Object
- **Description**: Font object used for group labels.

16. **`lResource`**:
- **Type**: Logical
- **Description**: Indicates whether the button bar is created from a resource.

#### Methods (METHOD)

1. **`New()`**:
- **Description**: Constructor for creating a new `TBar` instance.
- **Parameters**:
- `oWnd`: Parent window.
- `nBtnWidth`: Width of buttons.
- `nBtnHeight`: Height of buttons.
- `l3D`: 3D appearance flag.
- `cMode`: Mode of the button bar (TOP, LEFT, RIGHT, BOTTOM, FLOAT).
- `oCursor`: Cursor object.
- `l2007`, `l2010`, `l2013`, `l2015`: Office style flags.
- `lBorder`: Border flag.
- `oBrush`: Brush object.
- `aGrad`: Gradient array.
- `nColor`: Color value.
- `lHScroll`: Horizontal scroll flag.
- `nAlto`: Height adjustment.
- `lGDIP`: GDI+ flag.
- `lDesign`: Design mode flag.
- `cVarName`: Variable name for the button bar.

2. **`NewAt()`**:
- **Description**: Constructor for creating a `TBar` at a specific position.
- **Parameters**: Similar to `New()`, but with additional position parameters (`nRow`, `nCol`, `nWidth`, `nHeight`).

3. **`Add()`**:
- **Description**: Adds a button to the button bar.
- **Parameters**:
- `oBtnBmp`: Button object.
- `nPos`: Position to add the button.

4. **`AddGroup()`**:
- **Description**: Adds a group of buttons to the button bar.
- **Parameters**:
- `nPos`: Position to add the group.

5. **`Adjust()`**:
- **Description**: Adjusts the button bar's layout.

6. **`BtnAdjust()`**:
- **Description**: Adjusts the positions of buttons within the button bar.
- **Parameters**:
- `lRefresh`: Refresh flag.

7. **`Del()`**:
- **Description**: Deletes a button from the button bar.
- **Parameters**:
- `nPos`: Position of the button to delete.
- `lRefresh`: Refresh flag.

8. **`DelGroup()`**:
- **Description**: Deletes a group of buttons from the button bar.
- **Parameters**:
- `nPos`: Position of the group to delete.

9. **`Display()`**:
- **Description**: Displays the button bar by painting it.

10. **`EraseBkGnd()`**:
- **Description**: Erases the background of the button bar.

11. **`FastEditItems()`**:
- **Description**: Provides fast edit options for the button bar.

12. **`Float()`**:
- **Description**: Makes the button bar float.

13. **`GoDown()`**:
- **Description**: Moves the button bar to the bottom of the window.

14. **`GoLeft()`**:
- **Description**: Moves the button bar to the left side of the window.

15. **`GoRight()`**:
- **Description**: Moves the button bar to the right side of the window.

16. **`GoTop()`**:
- **Description**: Moves the button bar to the top of the window.

17. **`cGenPRG()`**:
- **Description**: Generates PRG code for the button bar.
- **Parameters**:
- `lDlgUnits`: Dialog units flag.

18. **`GetBtnTop()`**:
- **Description**: Gets the top position of a button.
- **Parameters**:
- `lNewGroup`: New group flag.

19. **`GetBtnLeft()`**:
- **Description**: Gets the left position of a button.
- **Parameters**:
- `lNewGroup`: New group flag.
- `nInd`: Index of the button.

20. **`Html()`**:
- **Description**: Generates HTML code for the button bar.

21. **`RePosRightBtns()`**:
- **Description**: Repositions buttons on the right side of the button bar.

22. **`RButtonDown()`**:
- **Description**: Handles right-click events on the button bar.
- **Parameters**:
- `nRow`: Row position.
- `nCol`: Column position.
- `nFlags`: Flags.

23. **`SaveIni()`**:
- **Description**: Saves the button bar configuration to an INI file.
- **Parameters**:
- `cBarName`: Name of the button bar.
- `cFile`: File name.

24. **`MouseMove()`**:
- **Description**: Handles mouse move events.
- **Parameters**:
- `nRow`: Row position.
- `nCol`: Column position.
- `nKeyFlags`: Key flags.

25. **`FillArea()`**:
- **Description**: Fills a specific area of the button bar.
- **Parameters**:
- `aRect`: Rectangle coordinates.
- `uFill`: Fill value.

26. **`Paint()`**:
- **Description**: Paints the button bar.

27. **`CloseGroup()`**:
- **Description**: Closes a group of buttons.
- **Parameters**:
- `oGrp`: Group object.
- `nSep`: Separation value.
- `hDarkPen`: Dark pen handle.
- `hLightPen`: Light pen handle.
- `lLabelSpace`: Label space flag.
- `lRight`: Right flag.

28. **`PaintSeparator()`**:
- **Description**: Paints a separator between groups.
- **Parameters**:
- `nPos`: Position.
- `hDarkPen`: Dark pen handle.
- `hLightPen`: Light pen handle.

29. **`FloatClick()`**:
- **Description**: Handles click events on a floating button bar.
- **Parameters**:
- `nRow`: Row position.
- `nCol`: Column position.
- `oWnd`: Window object.

30. **`Redefine()`**:
- **Description**: Redefines the button bar.
- **Parameters**:
- `nId`: ID.
- `oWnd`: Window object.
- `nWidth`: Width.
- `nHeight`: Height.
- `l2007`, `l2010`, `l2013`, `l2015`: Office style flags.
- `lBorder`: Border flag.

31. **`Initiate()`**:
- **Description**: Initiates the button bar.
- **Parameters**:
- `hDlg`: Dialog handle.

32. **`SetGradients()`**:
- **Description**: Sets gradient colors for the button bar.
- **Parameters**:
- `aGrad`: Gradient array.
- `oBrush`: Brush object.
- `nColor`: Color value.

#### Additional Notes
- The `TBar` class is highly customizable, allowing for different styles, appearances, and behaviors based on the parameters passed to its methods.
- The class supports various Office-like styles (2007, 2010, 2013, 2015) and can be used in both design and runtime modes.
- The button bar can be dynamically adjusted, and buttons can be added or removed at runtime.
- The class also provides methods for saving and loading the button bar configuration, making it suitable for applications that require persistent UI settings.

This documentation should provide a comprehensive understanding of the `TBar` class, its data members, and its methods.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBarTabs documentation:
### Class Documentation: `TBarTabs`

#### Overview
The `TBarTabs` class is designed to manage a set of tabs and associated bars within a window. It provides functionality to create, manage, and switch between different bars (or panels) within a tabbed interface. This class is particularly useful in GUI applications where you need to organize content into multiple tabs, each with its own set of controls or content.

#### Data Members (DATA)

1. **`aBars`**
- **Type:** Array
- **Description:** This array holds instances of `TBar` objects, each representing a bar (or panel) associated with a tab. The array is dynamically populated based on the number of tabs created.

2. **`oTabs`**
- **Type:** Object (TTabs)
- **Description:** This object represents the tab control itself. It is responsible for managing the tabs, including their labels and associated actions when a tab is selected.

3. **`oPanel`**
- **Type:** Object (TPanel)
- **Description:** This object represents the panel that contains the tabs and bars. It acts as a container for the tab control and the bars.

4. **`oWnd`**
- **Type:** Object (Window)
- **Description:** This object represents the parent window to which the tabbed interface belongs. The `TBarTabs` class is designed to be used within a window context.

5. **`nBar`**
- **Type:** Numeric
- **Description:** This variable keeps track of the currently active bar (or tab). It stores the index of the currently selected bar in the `aBars` array.

#### Methods (METHOD)

1. **`New( oWnd, nBtnWidth, nBtnHeight, aPrompts, acBitmaps, nOption, l3D, l2007 )`**
- **Type:** Constructor
- **Description:** This method initializes a new instance of the `TBarTabs` class. It sets up the tab control, creates the bars, and configures the initial state of the tabbed interface.
- **Parameters:**
- `oWnd`: The parent window object.
- `nBtnWidth`: The width of the buttons (tabs).
- `nBtnHeight`: The height of the buttons (tabs).
- `aPrompts`: An array of strings representing the labels for each tab.
- `acBitmaps`: An array of bitmaps associated with each tab (optional).
- `nOption`: The index of the initially selected tab (default is 1).
- `l3D`: A logical value indicating whether to use 3D effects for the bars (default is `.f.`).
- `l2007`: A logical value indicating whether to use a 2007-style appearance (default is `.t.`).

2. **`AddBar( cPrompt, cBitmap )`**
- **Type:** Public
- **Description:** This method adds a new bar (or tab) to the tabbed interface. It creates a new `TBar` object, adds it to the `aBars` array, and updates the tab control with the new tab.
- **Parameters:**
- `cPrompt`: The label for the new tab.
- `cBitmap`: The bitmap associated with the new tab (optional).
- **Returns:** The newly created `TBar` object.

3. **`SetBar( nOption )`**
- **Type:** Protected
- **Description:** This method is used internally to switch between different bars (or tabs). It hides the currently visible bar and shows the bar corresponding to the selected tab.
- **Parameters:**
- `nOption`: The index of the bar to be displayed.
- **Returns:** The index of the previously active bar.

#### Detailed Method Descriptions

- **`New` Method:**
- The `New` method initializes the `TBarTabs` object. It sets up the panel, creates the tab control, and initializes the bars. The method also sets the initial active bar based on the `nOption` parameter. The bars are created with the specified dimensions and styles, and the initially selected bar is displayed while the others are hidden.

- **`AddBar` Method:**
- The `AddBar` method allows dynamic addition of new bars (or tabs) to the tabbed interface. It adds a new tab to the `oTabs` object and creates a corresponding `TBar` object, which is then added to the `aBars` array. The new bar is initially hidden, and the method ensures that the currently active bar remains visible.

- **`SetBar` Method:**
- The `SetBar` method is responsible for switching between bars. It hides the currently visible bar and shows the bar corresponding to the selected tab. This method is called internally when a tab is selected, ensuring that the correct bar is displayed.

#### Usage Example
```xBase
// Assuming oWnd is a valid window object
LOCAL oBarTabs := TBarTabs():New( oWnd, 100, 30, { "Tab1", "Tab2", "Tab3" }, { "bmp1.bmp", "bmp2.bmp", "bmp3.bmp" } )

// Adding a new tab dynamically
oBarTabs:AddBar( "Tab4", "bmp4.bmp" )

// Switching to the second tab
oBarTabs:SetBar( 2 )
```

This class is particularly useful in applications where you need to manage multiple views or panels within a single window, allowing users to switch between them using a tabbed interface.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBitmap documentation:
### Class Documentation: `TBitmap`

The `TBitmap` class is a control class in the FiveWin library, designed to handle bitmap images within a window. It provides functionalities to load, display, manipulate, and interact with bitmap images. The class inherits from `TControl`, which is a base class for controls in FiveWin, and extends it with bitmap-specific features.

#### Key Features:
- **Bitmap Loading**: Supports loading bitmaps from resources, files, and the clipboard.
- **Bitmap Display**: Allows for stretching, scrolling, and zooming of the bitmap.
- **Transparency**: Supports transparent bitmaps and alpha blending.
- **Event Handling**: Provides methods to handle mouse and keyboard events.
- **Clipboard Integration**: Allows copying bitmaps to and from the clipboard.
- **Scrollable Bitmaps**: Supports vertical and horizontal scrolling for large bitmaps.

---

### **DATA Members**

| **Data Member** | **Type** | **Description** |
|------------------------|---------------|---------------------------------------------------------------------------------|
| `lRegistered` | `LOGICAL` | Indicates whether the class is registered. |
| `aProperties` | `ARRAY` | List of properties for the class. |
| `nX`, `nY` | `NUMERIC` | Current X and Y positions of the bitmap. |
| `nOldX`, `nOldY` | `NUMERIC` | Previous X and Y positions of the bitmap. |
| `hBitmap` | `HANDLE` | Handle to the bitmap. |
| `hPalette` | `HANDLE` | Handle to the bitmap's palette. |
| `cBmpFile` | `CHARACTER` | File path of the bitmap. |
| `cResName` | `CHARACTER` | Resource name of the bitmap. |
| `lScroll` | `LOGICAL` | Indicates whether scrolling is enabled. |
| `lStretch` | `LOGICAL` | Indicates whether the bitmap should be stretched to fit the control. |
| `aHotAreas` | `ARRAY` | Array of hot areas within the bitmap. |
| `nVStep`, `nHStep` | `NUMERIC` | Vertical and horizontal scroll steps. |
| `nZoom` | `NUMERIC` | Zoom level of the bitmap. |
| `lTransparent` | `LOGICAL` | Indicates whether the bitmap is transparent. |
| `lHasAlpha` | `LOGICAL` | Indicates whether the bitmap has an alpha channel. |
| `bAlphaLevel` | `BLOCK` | Block to calculate the alpha level. |
| `hAlphaLevel` | `NUMERIC` | Current alpha level of the bitmap. |
| `bMLeave` | `BLOCK` | Block to handle mouse leave events. |
| `nImgWidth` | `NUMERIC` | Width of the bitmap image. |
| `nImgHeight` | `NUMERIC` | Height of the bitmap image. |

---

### **METHODS**

#### **Constructor Methods**

| **Method** | **Description** |
|------------------------|---------------------------------------------------------------------------------|
| `New()` | Constructor for creating a new `TBitmap` object. Initializes properties and loads the bitmap. |
| `Define()` | Creates a bitmap object without creating a control. Used for standalone bitmaps. |
| `ReDefine()` | Redefines an existing bitmap object with new properties. |

#### **Bitmap Manipulation Methods**

| **Method** | **Description** |
|------------------------|---------------------------------------------------------------------------------|
| `LoadImage()` | Loads a bitmap from a resource or file. |
| `ReLoad()` | Reloads the bitmap from a resource or file. |
| `LoadFromClipboard()` | Loads a bitmap from the clipboard. |
| `LoadFromString()` | Loads a bitmap from a string. |
| `CopyToClipboard()` | Copies the bitmap to the clipboard. |
| `Clear()` | Clears the bitmap from the control. |
| `Zoom()` | Sets or retrieves the zoom level of the bitmap. |

#### **Display and Rendering Methods**

| **Method** | **Description** |
|------------------------|---------------------------------------------------------------------------------|
| `Paint()` | Paints the bitmap on the control. |
| `EraseBkGnd()` | Handles background erasing for the bitmap. |
| `Display()` | Displays the bitmap by calling `Paint()`. |
| `SetBMP()` | Sets the bitmap from a resource. |
| `SetFore()` | Sets the bitmap as the foreground. |
| `LoadBMP()` | Loads a bitmap from a file. |

#### **Scrolling Methods**

| **Method** | **Description** |
|------------------------|---------------------------------------------------------------------------------|
| `ScrollUp()` | Scrolls the bitmap up. |
| `ScrollDown()` | Scrolls the bitmap down. |
| `ScrollLeft()` | Scrolls the bitmap left. |
| `ScrollRight()` | Scrolls the bitmap right. |
| `PageUp()` | Scrolls the bitmap up by a page. |
| `PageDown()` | Scrolls the bitmap down by a page. |
| `PageLeft()` | Scrolls the bitmap left by a page. |
| `PageRight()` | Scrolls the bitmap right by a page. |
| `VScroll()` | Handles vertical scrolling events. |
| `HScroll()` | Handles horizontal scrolling events. |
| `ScrollAdjust()` | Adjusts scrollbars based on the bitmap size. |

#### **Event Handling Methods**

| **Method** | **Description** |
|------------------------|---------------------------------------------------------------------------------|
| `HandleEvent()` | Handles window messages, including mouse and keyboard events. |
| `MouseLeave()` | Handles mouse leave events. |
| `KeyDown()` | Handles key down events. |
| `Command()` | Handles command events. |

#### **Utility Methods**

| **Method** | **Description** |
|------------------------|---------------------------------------------------------------------------------|
| `Center()` | Centers the bitmap within the control. |
| `AdjControls()` | Adjusts child controls when the bitmap is scrolled. |
| `Default()` | Sets default properties for the bitmap. |
| `cGenPRG()` | Generates PRG code for the bitmap control. |
| `Inspect()` | Inspects and modifies bitmap properties. |
| `Destroy()` | Destroys the bitmap and releases resources. |
| `Initiate()` | Initiates the bitmap control. |

#### **Alpha and Transparency Methods**

| **Method** | **Description** |
|------------------------|---------------------------------------------------------------------------------|
| `HasAlpha()` | Checks if the bitmap has an alpha channel. |
| `nAlphaLevel()` | Sets or retrieves the alpha level of the bitmap. |

---

### **Detailed Method Descriptions**

#### **1. `New()`**
- **Purpose**: Constructor for creating a new `TBitmap` object.
- **Parameters**:
- `nTop`, `nLeft`, `nWidth`, `nHeight`: Position and size of the bitmap control.
- `cResName`, `cBmpFile`: Resource name or file path of the bitmap.
- `lNoBorder`, `lScroll`, `lStretch`: Control appearance and behavior flags.
- `oWnd`: Parent window.
- `bLClicked`, `bRClicked`: Blocks for left and right click events.
- `oCursor`: Cursor to display when hovering over the bitmap.
- `cMsg`: Message to display.
- `lUpdate`, `bWhen`, `bValid`: Control update and validation blocks.
- `lDesign`: Indicates if the control is in design mode.
- **Returns**: A new `TBitmap` object.

#### **2. `Define()`**
- **Purpose**: Creates a bitmap object without creating a control.
- **Parameters**:
- `cResName`, `cBmpFile`: Resource name or file path of the bitmap.
- `oWnd`: Parent window.
- `hBitmap`: Handle to an existing bitmap.
- **Returns**: A new `TBitmap` object.

#### **3. `ReDefine()`**
- **Purpose**: Redefines an existing bitmap object with new properties.
- **Parameters**:
- `nId`: Control ID.
- `cResName`, `cBmpFile`: Resource name or file path of the bitmap.
- `oWnd`: Parent window.
- `bLClicked`, `bRClicked`: Blocks for left and right click events.
- `lScroll`, `lStretch`: Control appearance and behavior flags.
- `oCursor`: Cursor to display when hovering over the bitmap.
- `cMsg`: Message to display.
- `lUpdate`, `bWhen`, `bValid`: Control update and validation blocks.
- `lTransparent`: Indicates if the bitmap is transparent.
- **Returns**: The redefined `TBitmap` object.

#### **4. `LoadImage()`**
- **Purpose**: Loads a bitmap from a resource or file.
- **Parameters**:
- `cResName`: Resource name of the bitmap.
- `cBmpFile`: File path of the bitmap.
- **Returns**: Logical value indicating success or failure.

#### **5. `Paint()`**
- **Purpose**: Paints the bitmap on the control.
- **Parameters**: None.
- **Returns**: None.

#### **6. `ScrollAdjust()`**
- **Purpose**: Adjusts scrollbars based on the bitmap size.
- **Parameters**: None.
- **Returns**: None.

#### **7. `Destroy()`**
- **Purpose**: Destroys the bitmap and releases resources.
- **Parameters**: None.
- **Returns**: None.

---

### **Usage Example**

```xbase
// Create a new bitmap control
oBitmap := TBitmap():New( 10, 10, 200, 150, "MYBITMAP", "C:\Images\MyImage.bmp", .F., oWnd )

// Load a bitmap from a file
oBitmap:LoadBMP( "C:\Images\AnotherImage.bmp" )

// Set the bitmap to be transparent
oBitmap:lTransparent := .T.

// Zoom the bitmap
oBitmap:Zoom( 1.5 )

// Display the bitmap
oBitmap:Display()
```

---

This documentation provides a comprehensive overview of the `TBitmap` class, its data members, and methods, along with usage examples.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBlock documentation:
### Class Documentation: `TBlock`

#### Overview:
The `TBlock` class is a part of the FiveWin framework, which is commonly used in Clipper and xBase programming. This class is designed to encapsulate a code block (a piece of code that can be executed later) and provides methods to evaluate or execute this code block with optional parameters.

#### Purpose:
The `TBlock` class allows you to store a code expression as a string, convert it into an executable code block, and then evaluate or execute this block with up to five parameters. This is useful in scenarios where you need to dynamically execute code based on runtime conditions or configurations.

---

### DATA Members:

1. **`cExpression`**
- **Type:** String
- **Description:** This data member stores the code expression as a string. The expression is later converted into an executable code block.

2. **`bBlock`**
- **Type:** Code Block
- **Description:** This data member holds the executable code block that is created from the `cExpression` string. It is used to evaluate or execute the code.

---

### METHODS:

1. **`New( cExpression )`**
- **Type:** Constructor
- **Description:** This method initializes a new instance of the `TBlock` class. It takes a string `cExpression` as input, which represents the code to be executed. The method checks if the expression is valid. If valid, it converts the string into an executable code block and assigns it to `::bBlock`. If the expression is invalid, it displays an alert message.
- **Parameters:**
- `cExpression`: A string representing the code expression to be executed.
- **Returns:** `nil` (no return value).

2. **`Eval( uPar1, uPar2, uPar3, uPar4, uPar5 )`**
- **Type:** Inline Method
- **Description:** This method evaluates the code block stored in `::bBlock` with up to five optional parameters. If `::bBlock` is not `nil`, it executes the code block using the `Eval` function and passes the parameters to it. If `::bBlock` is `nil`, it does nothing.
- **Parameters:**
- `uPar1`, `uPar2`, `uPar3`, `uPar4`, `uPar5`: Optional parameters to be passed to the code block.
- **Returns:** The result of evaluating the code block, or `nil` if `::bBlock` is `nil`.

3. **`Exec( uPar1, uPar2, uPar3, uPar4, uPar5 )`**
- **Type:** Inline Method
- **Description:** This method is functionally identical to `Eval`. It evaluates the code block stored in `::bBlock` with up to five optional parameters. If `::bBlock` is not `nil`, it executes the code block using the `Eval` function and passes the parameters to it. If `::bBlock` is `nil`, it does nothing.
- **Parameters:**
- `uPar1`, `uPar2`, `uPar3`, `uPar4`, `uPar5`: Optional parameters to be passed to the code block.
- **Returns:** The result of evaluating the code block, or `nil` if `::bBlock` is `nil`.

---

### Example Usage:

```clipper
// Create a new TBlock instance with a code expression
oBlock := TBlock:New( "{ |x, y| x + y }" )

// Evaluate the code block with parameters
? oBlock:Eval( 5, 10 ) // Output: 15

// Execute the code block with parameters
? oBlock:Exec( 3, 7 ) // Output: 10
```

---

### Notes:
- The `Eval` and `Exec` methods are identical in functionality. The presence of both methods might be for backward compatibility or to provide alternative naming conventions.
- The `New` constructor ensures that the provided expression is valid before converting it into a code block. If the expression is invalid, it alerts the user and does not initialize the code block.
- The `&` operator in the `New` method is used to convert the string expression into a code block. This is a powerful feature but should be used with caution to avoid security risks (e.g., code injection).

This class is a simple yet powerful tool for dynamically executing code in FiveWin applications.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBrush documentation:
### **Class Documentation: `TBrush`**

The `TBrush` class is designed to manage and manipulate brush objects in a Windows-based graphical environment. Brushes are used to fill shapes, backgrounds, and other graphical elements with colors, patterns, or gradients. This class provides a comprehensive set of methods and data members to create, modify, and manage brushes, including support for solid colors, patterns, gradients, and bitmap-based brushes.

---

### **DATA Members**

1. **`hBrush`**
- **Type**: Handle (Numeric)
- **Description**: The handle to the brush object. This is the primary identifier for the brush in the Windows GDI (Graphics Device Interface).

2. **`hBitmap`**
- **Type**: Handle (Numeric)
- **Description**: The handle to the bitmap used for pattern brushes. This is relevant when the brush is created from a bitmap.

3. **`hBmpOrgl`**
- **Type**: Handle (Numeric)
- **Description**: The handle to the original bitmap before any resizing or modifications. This is used to restore or reference the original bitmap.

4. **`nBmpFormat`**
- **Type**: Numeric
- **Description**: The format of the bitmap used in the brush. Initialized to `0`.

5. **`nCount`**
- **Type**: Numeric
- **Description**: A counter to track the number of references to the brush. Used for memory management.

6. **`cStyle`**
- **Type**: Character (String)
- **Description**: The style of the brush (e.g., "HORIZONTAL", "VERTICAL", "CROSS", etc.). This is used for hatch brushes.

7. **`nRGBColor`**
- **Type**: Numeric
- **Description**: The RGB color value used for solid or hatch brushes.

8. **`cBmpFile`**
- **Type**: Character (String)
- **Description**: The file path of the bitmap used to create the brush.

9. **`cBmpRes`**
- **Type**: Character (String)
- **Description**: The resource name of the bitmap used to create the brush.

10. **`lSystem`**
- **Type**: Logical (Boolean)
- **Description**: Indicates whether the brush is a system brush (e.g., stock brush). If `.T.`, the brush is a system brush.

11. **`aGrad`**
- **Type**: Array
- **Description**: An array containing gradient colors for gradient brushes.

12. **`uSource`**
- **Type**: Variant
- **Description**: The source of the brush, which can be a color, bitmap, or gradient.

13. **`nResizeMode`**
- **Type**: Numeric
- **Description**: The mode used for resizing the brush. Initialized to `0`.

14. **`oRect`**
- **Type**: Object (TRect)
- **Description**: The rectangle object defining the area for which the brush is resized.

15. **`lClientArea`**
- **Type**: Logical (Boolean)
- **Description**: If `.T.`, the brush is resized to fit the client area of a window, excluding borders.

16. **`aOrg`**
- **Type**: Array
- **Description**: An array storing the original coordinates of the brush.

17. **`lGdip`**
- **Type**: Logical (Boolean)
- **Description**: Indicates whether the brush uses GDI+ (Graphics Device Interface Plus). Initialized to `.F.`.

18. **`pBrush`**
- **Type**: Pointer (Protected)
- **Description**: A pointer to the GDI+ brush object. Used for advanced graphical operations.

19. **`Cargo`**
- **Type**: Variant
- **Description**: A generic data holder for additional user-defined information.

20. **`aBrushes` (Class Data)**
- **Type**: Array
- **Description**: A static array storing all instances of `TBrush` objects.

21. **`aProperties` (Class Data)**
- **Type**: Array
- **Description**: A static array listing the properties of the brush that can be saved or loaded.

---

### **METHODS**

1. **`New(cStyle, nRGBColor, cBmpFile, cBmpRes, nBmpHandle, cResizeMode)`**
- **Description**: Constructor method for creating a new `TBrush` object. It initializes the brush based on the provided parameters (style, color, bitmap file, bitmap resource, etc.).
- **Parameters**:
- `cStyle`: The style of the brush (e.g., "HORIZONTAL", "VERTICAL").
- `nRGBColor`: The RGB color value for the brush.
- `cBmpFile`: The file path of the bitmap.
- `cBmpRes`: The resource name of the bitmap.
- `nBmpHandle`: The handle to an existing bitmap.
- `cResizeMode`: The mode for resizing the brush.
- **Returns**: The newly created `TBrush` object.

2. **`cGenPRG(cVar)`**
- **Description**: Generates a PRG (program) code snippet that can be used to recreate the brush object.
- **Parameters**:
- `cVar`: The variable name to use in the generated code.
- **Returns**: A string containing the PRG code.

3. **`End()`**
- **Description**: Destructor method that releases the brush and associated resources. It deletes the brush handle and bitmap if they are not system objects.
- **Returns**: `nil`.

4. **`Load(cInfo)`**
- **Description**: Loads brush properties from a binary string. This method is used for deserialization.
- **Parameters**:
- `cInfo`: A binary string containing the brush properties.
- **Returns**: `nil`.

5. **`Release()`**
- **Description**: Alias for the `End()` method. Releases the brush and associated resources.
- **Returns**: `nil`.

6. **`Save()`**
- **Description**: Saves the brush properties to a binary string. This method is used for serialization.
- **Returns**: A binary string containing the brush properties.

7. **`Resized(x, y, nMode)`**
- **Description**: Creates a new brush object that is a resized version of the current brush.
- **Parameters**:
- `x`: The new width of the brush.
- `y`: The new height of the brush.
- `nMode`: The resizing mode.
- **Returns**: A new `TBrush` object.

8. **`Cropped(oWnd, oChildRect)`**
- **Description**: Creates a new brush object that is a cropped version of the current brush.
- **Parameters**:
- `oWnd`: The window object associated with the brush.
- `oChildRect`: The rectangle defining the area to crop.
- **Returns**: A new `TBrush` object.

9. **`DataRect(oWnd)`**
- **Description**: Calculates the rectangle area for the brush based on the window's client area.
- **Parameters**:
- `oWnd`: The window object.
- **Returns**: A `TRect` object.

10. **`SaveToText(nIndent)`**
- **Description**: Saves the brush properties to a text format, suitable for debugging or logging.
- **Parameters**:
- `nIndent`: The indentation level for the text output.
- **Returns**: A string containing the brush properties in text format.

11. **`SetSize(nWidth, nHeight)`**
- **Description**: Resizes the brush to the specified width and height.
- **Parameters**:
- `nWidth`: The new width of the brush.
- `nHeight`: The new height of the brush.
- **Returns**: The modified `TBrush` object.

12. **`Resize(oWnd, nOrgX, nOrgY)`**
- **Description**: Resizes the brush to fit the specified window's client area.
- **Parameters**:
- `oWnd`: The window object.
- `nOrgX`: The X-coordinate offset.
- `nOrgY`: The Y-coordinate offset.
- **Returns**: A `TRect` object.

13. **`Copy()`**
- **Description**: Creates a copy of the current brush object.
- **Returns**: A new `TBrush` object.

14. **`GdipBrush()`**
- **Description**: Creates a GDI+ brush object from the current brush.
- **Returns**: A pointer to the GDI+ brush.

15. **`SameAs(oBrush)`**
- **Description**: Compares the current brush with another brush to check if they are the same.
- **Parameters**:
- `oBrush`: The brush object to compare with.
- **Returns**: `.T.` if the brushes are the same, otherwise `.F.`.

16. **`==` (Operator)**
- **Description**: Overloaded equality operator to compare two brushes using the `SameAs` method.
- **Parameters**:
- `o`: The brush object to compare with.
- **Returns**: `.T.` if the brushes are the same, otherwise `.F.`.

17. **`!=` (Operator)**
- **Description**: Overloaded inequality operator to compare two brushes using the `SameAs` method.
- **Parameters**:
- `o`: The brush object to compare with.
- **Returns**: `.T.` if the brushes are not the same, otherwise `.F.`.

---

### **Additional Functions**

1. **`ResizeBitmap(hBmp, nWndW, nWndH, nMode, lCrop)`**
- **Description**: Resizes a bitmap to the specified dimensions.
- **Parameters**:
- `hBmp`: The handle to the bitmap.
- `nWndW`: The new width.
- `nWndH`: The new height.
- `nMode`: The resizing mode.
- `lCrop`: If `.T.`, the bitmap is cropped after resizing.
- **Returns**: The handle to the resized bitmap.

2. **`GradientBmp(hDC, nWidth, nHeight, aColors, lVert)`**
- **Description**: Creates a gradient bitmap.
- **Parameters**:
- `hDC`: The device context.
- `nWidth`: The width of the bitmap.
- `nHeight`: The height of the bitmap.
- `aColors`: An array of gradient colors.
- `lVert`: If `.T.`, the gradient is vertical; otherwise, horizontal.
- **Returns**: The handle to the gradient bitmap.

3. **`CropBmp(hBmp, oRect)`**
- **Description**: Crops a bitmap to the specified rectangle.
- **Parameters**:
- `hBmp`: The handle to the bitmap.
- `oRect`: The rectangle defining the area to crop.
- **Returns**: The handle to the cropped bitmap.

4. **`GradientBrush(hDC, nTop, nLeft, nWidth, nHeight, aColors, lVert)`**
- **Description**: Creates a gradient brush.
- **Parameters**:
- `hDC`: The device context.
- `nTop`: The top coordinate.
- `nLeft`: The left coordinate.
- `nWidth`: The width of the brush.
- `nHeight`: The height of the brush.
- `aColors`: An array of gradient colors.
- `lVert`: If `.T.`, the gradient is vertical; otherwise, horizontal.
- **Returns**: The handle to the gradient brush.

---

### **Summary**

The `TBrush` class is a powerful tool for managing brushes in a Windows-based graphical environment. It supports a wide range of brush types, including solid colors, patterns, gradients, and bitmap-based brushes. The class provides methods for creating, modifying, and managing brushes, as well as serialization and deserialization capabilities. This makes it suitable for use in applications that require dynamic and flexible brush management.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBrushEx documentation:
### Class Documentation: `TBrushEx`

#### Overview
The `TBrushEx` class is designed to create a brush from a bitmap. The bitmap can be generated with specific dimensions and colors, and it can include a gradient effect (either vertical or horizontal). If a second color is not provided, the bitmap will be a flat color. The user is responsible for destroying the brush if it is not managed by the system.

---

### DATA Members

1. **`hBrush`**
- **Type**: Handle
- **Description**: This holds the handle to the brush created from the bitmap. The brush is used for filling shapes or backgrounds in graphical applications.

2. **`hBitmap`**
- **Type**: Handle
- **Description**: This holds the handle to the bitmap created with the specified dimensions and colors. The bitmap is used to create the brush.

---

### METHODS

#### 1. **`New(nWidth, nHeight, nColor, nColor2, lVGrad)`**
- **Type**: Constructor
- **Parameters**:
- `nWidth`: The width of the bitmap.
- `nHeight`: The height of the bitmap.
- `nColor`: The primary color of the bitmap.
- `nColor2`: (Optional) The secondary color for creating a gradient effect. If not provided, the bitmap will be a flat color.
- `lVGrad`: (Optional) A logical value indicating whether the gradient is vertical (`TRUE`) or horizontal (`FALSE`).
- **Description**:
- This method creates a bitmap using the `CreaBitmapEx` function with the specified dimensions, colors, and gradient orientation.
- It then creates a brush (`hBrush`) from the bitmap using the `CreatePatternBrush` function.
- The method returns the instance of the `TBrushEx` class.

#### 2. **`NewEx(nWidth, nHeight, nColor, nColor2, nColor3, nColor4, lVGrad)`**
- **Type**: Constructor
- **Parameters**:
- `nWidth`: The width of the bitmap.
- `nHeight`: The height of the bitmap.
- `nColor`: The primary color of the bitmap.
- `nColor2`: The secondary color for creating a gradient effect.
- `nColor3`: The third color for more complex gradient effects.
- `nColor4`: The fourth color for more complex gradient effects.
- `lVGrad`: (Optional) A logical value indicating whether the gradient is vertical (`TRUE`) or horizontal (`FALSE`).
- **Description**:
- This method creates a bitmap using the `CreaBitmapEx2` function with the specified dimensions, colors, and gradient orientation.
- It then creates a brush (`hBrush`) from the bitmap using the `CreatePatternBrush` function.
- The method returns the instance of the `TBrushEx` class.

#### 3. **`End()`**
- **Type**: Destructor
- **Description**:
- This method is used to clean up resources by deleting the brush (`hBrush`) and the bitmap (`hBitmap`) using the `DeleteObject` function.
- It is marked as `INLINE`, meaning the code is directly inserted where the method is called, improving performance for small, frequently used methods.

---

### Notes:
- The `TBrushEx` class is useful for creating custom brushes with gradients or flat colors, which can be used in graphical applications.
- The user must manually call the `End()` method to release resources when the brush is no longer needed, unless the system manages it.
- The commented-out lines (`//::nCount := 1` and `//AAdd( ::aBrushes, Self )`) suggest that the class might have been designed to track instances or manage a collection of brushes, but this functionality is not implemented in the provided code.

---

This class is a powerful tool for creating and managing custom brushes in graphical applications, especially when gradients or specific color patterns are required.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBtnBmp documentation:
### Documentation for the `TBtnBmp` Class

The `TBtnBmp` class is a custom button control class in the FiveWin library, designed to handle bitmap buttons with various states (normal, pressed, disabled, hover). It supports features like bitmap loading, button states, tooltips, and more. This class is particularly useful for creating visually rich buttons with images and text.

---

### **Class Overview**

- **Purpose**: The `TBtnBmp` class is used to create buttons that can display bitmaps and text. It supports multiple states (normal, pressed, disabled, hover) and can be customized with different layouts, borders, and styles.
- **Inheritance**: Inherits from `TControl`, which is a base class for controls in FiveWin.
- **Features**:
- Supports bitmap buttons with up to 4 states (normal, pressed, disabled, hover).
- Customizable layouts (top, left, bottom, right, center).
- Supports transparency, gradients, and themed buttons.
- Handles mouse and keyboard events.
- Can display tooltips and popup menus.

---

### **DATA Members**

| **DATA** | **Type** | **Description** |
|------------------------|----------------|---------------------------------------------------------------------------------|
| `bAction` | Block | Codeblock to execute when the button is clicked. |
| `aBmpRect` | Array | Rectangle coordinates for the bitmap. |
| `cAction` | String | A string description of the action. |
| `lPressed` | Logical | Indicates if the button is currently pressed. |
| `lAdjust` | Logical | Indicates if the button should adjust its size based on the bitmap. |
| `lGroup` | Logical | Indicates if the button is part of a group. |
| `lWorking` | Logical | Indicates if the button is currently processing an action. |
| `lBtnUp` | Logical | Indicates if the button is in the "up" state. |
| `lBtnDown` | Logical | Indicates if the button is in the "down" state. |
| `lBoxSelect` | Logical | Indicates if the button should display a selection box. |
| `hBitmap1` | Handle | Handle to the normal state bitmap. |
| `hPalette1` | Handle | Palette for the normal state bitmap. |
| `hBitmap2` | Handle | Handle to the pressed state bitmap. |
| `hPalette2` | Handle | Palette for the pressed state bitmap. |
| `hBitmap3` | Handle | Handle to the disabled state bitmap. |
| `hPalette3` | Handle | Palette for the disabled state bitmap. |
| `hBitmap4` | Handle | Handle to the hover state bitmap. |
| `hPalette4` | Handle | Palette for the hover state bitmap. |
| `aImages` | Array | Array containing bitmap handles and related data for all states. |
| `aGradRect` | Array | Rectangle coordinates for gradient filling. |
| `aBrushOrg` | Array | Brush origin coordinates. |
| `cGrpLabel` | String | Group label for grouped buttons. |
| `aGrpClr` | Array | Group color settings. |
| `hBmp` | Handle | Current bitmap handle being painted. |
| `hPal` | Handle | Current palette handle being painted. |
| `lAlpha` | Logical | Indicates if the current bitmap has alpha transparency. |
| `nClrBack` | Numeric | Background color for the button. |
| `nTxtW` | Numeric | Width of the text. |
| `nBmpMargin` | Numeric | Margin for the bitmap. |
| `nBmpNo` | Numeric | Current bitmap number being painted. |
| `hRgn` | Handle | Handle to the region used for drawing. |
| `cResName1` | String | Resource name for the normal state bitmap. |
| `cResName2` | String | Resource name for the pressed state bitmap. |
| `cResName3` | String | Resource name for the disabled state bitmap. |
| `cResName4` | String | Resource name for the hover state bitmap. |
| `cBmpFile1` | String | File path for the normal state bitmap. |
| `cBmpFile2` | String | File path for the pressed state bitmap. |
| `cBmpFile3` | String | File path for the disabled state bitmap. |
| `cBmpFile4` | String | File path for the hover state bitmap. |
| `lProcessing` | Logical | Indicates if the button is currently processing an action. |
| `lBorder` | Logical | Indicates if the button has a border. |
| `lRound` | Logical | Indicates if the button has rounded corners. |
| `nRound` | Numeric | Radius for rounded corners. |
| `lEllipse` | Logical | Indicates if the button is elliptical. |
| `lBmpTransparent` | Logical | Indicates if the bitmap is transparent. |
| `oFontBold` | Object | Bold font object for the button text. |
| `oPopup` | Object | Popup menu associated with the button. |
| `nLayout` | Numeric | Layout type for the button (top, left, bottom, right, center). |
| `lMOver` | Logical | Indicates if the mouse is over the button. |
| `bClrGrad` | Block | Codeblock for gradient colors. |
| `l2007` | Logical | Indicates if the button uses the 2007 style. |
| `l2010` | Logical | Indicates if the button uses the 2010 style. |
| `lBarBtn` | Logical | Indicates if the button is part of a toolbar. |
| `lBtnBarBtn` | Logical | Indicates if the button is part of a toolbar and its parent is `TBar`. |
| `aAlpha` | Array | Array indicating if each bitmap has alpha transparency. |
| `bAlphaLevel` | Block | Codeblock for alpha level. |
| `hAlphaLevel` | Numeric | Alpha level for the bitmap. |
| `bColorMap` | Block | Codeblock for color mapping. |
| `bBmpNo` | Block | Codeblock for determining the current bitmap number. |
| `lDisColor` | Logical | Indicates if the button should use a disabled color. |
| `nClrTextDis` | Numeric | Disabled text color. |
| `nClrBorder` | Numeric | Border color. |
| `lFlatStyle` | Logical | Indicates if the button uses a flat style. |
| `nClrFocusRect` | Numeric | Color for the focus rectangle. |
| `nPenFocusRect` | Numeric | Pen style for the focus rectangle. |
| `nDeepFocusRect` | Numeric | Depth of the focus rectangle. |
| `lRight` | Logical | Indicates if the button is aligned to the right. |
| `nSaveLeft` | Numeric | Saved left position for the button. |
| `lThemed` | Logical | Indicates if the button uses a theme. |
| `oTheme` | Object | Theme object for themed buttons. |
| `lGDIP` | Logical | Indicates if the button uses GDI+ for drawing. |
| `l2013` | Logical | Indicates if the button uses the 2013 style. |
| `l2015` | Logical | Indicates if the button uses the 2015 style. |
| `lRegistered` | Logical | Indicates if the button is registered. |
| `lDefaultTheme` | Logical | Indicates if the button uses the default theme. |
| `lLegacyLookLeftRight` | Logical | Indicates if the button uses the legacy left/right look. |

---

### **METHODS**

| **Method** | **Description** |
|--------------------------------|---------------------------------------------------------------------------------|
| `New()` | Constructor for creating a new `TBtnBmp` instance. |
| `NewBar()` | Constructor for creating a new toolbar button. |
| `ReDefine()` | Redefines an existing button. |
| `Click()` | Handles the button click event. |
| `Display()` | Displays the button by painting it. |
| `Disable()` | Disables the button. |
| `Enable()` | Enables the button. |
| `End()` | Destroys the button. |
| `EraseBkGnd()` | Erases the background of the button. |
| `FreeBitmaps()` | Frees the bitmap resources. |
| `GetBmp()` | Selects the bitmap handle to paint based on the button state. |
| `GoUp()` | Sets the button to the "up" state. |
| `GoDown()` | Sets the button to the "down" state. |
| `ResetBorder()` | Resets the button border. |
| `cGenPRG()` | Generates PRG code for the button. |
| `LButtonDown()` | Handles the left mouse button down event. |
| `LButtonUp()` | Handles the left mouse button up event. |
| `LoadBitmaps()` | Loads bitmaps for the button states. |
| `SetImages()` | Sets the images for the button states. |
| `GotFocus()` | Handles the focus event. |
| `Initiate()` | Initializes the button. |
| `KeyChar()` | Handles key character events. |
| `KeyDown()` | Handles key down events. |
| `LostFocus()` | Handles the focus lost event. |
| `Paint()` | Paints the button. |
| `PaintBitmap()` | Paints the bitmap on the button. |
| `PaintBorder()` | Paints the button border. |
| `PaintCaption()` | Paints the button caption. |
| `PaintPopupSection()` | Paints the popup section of the button. |
| `FillArea()` | Fills the button area with a specified color or gradient. |
| `PaintBackGroundAs20072010()` | Paints the background in the 2007/2010 style. |
| `PaintBackGroundStandard()` | Paints the background in the standard style. |
| `PaintBackGroundThemed()` | Paints the background in the themed style. |
| `MouseMove()` | Handles mouse movement over the button. |
| `Destroy()` | Destroys the button and frees resources. |
| `DrawEllipse()` | Draws an ellipse on the button. |
| `DrawFocusEllipse()` | Draws a focus ellipse on the button. |
| `FocusRect()` | Draws a focus rectangle on the button. |
| `SetFile()` | Sets the bitmap files for the button states. |
| `Toggle()` | Toggles the button state between pressed and unpressed. |
| `HandleEvent()` | Handles various events (mouse, keyboard, etc.). |
| `HasAlpha()` | Checks if a bitmap has alpha transparency. |
| `MouseLeave()` | Handles the mouse leave event. |
| `ShowPopup()` | Displays a popup menu associated with the button. |
| `SetColor()` | Sets the button's text and background colors. |
| `nAlphaLevel()` | Gets or sets the alpha level for the button. |
| `aGrad()` | Returns the gradient colors for the button. |
| `CheckTheme()` | Checks and applies the theme for the button. |
| `SetThemed()` | Enables or disables the themed style for the button. |
| `Html()` | Generates HTML code for the button. |
| `_Eval()` | Evaluates a codeblock with the button as a parameter. |

---

### **Key Features**

1. **Bitmap Support**: The class supports up to 4 bitmaps for different button states (normal, pressed, disabled, hover).
2. **Customizable Layouts**: The button can be customized to display text and bitmaps in different layouts (top, left, bottom, right, center).
3. **Transparency and Gradients**: Supports transparent bitmaps and gradient backgrounds.
4. **Themed Buttons**: Can be themed to match the application's style.
5. **Popup Menus**: Supports popup menus for additional functionality.
6. **Event Handling**: Handles mouse and keyboard events, including clicks, focus, and key presses.

---

### **Usage Example**

```clipper
// Create a new bitmap button
oBtn := TBtnBmp():New( 10, 10, 100, 30, "normal.bmp", "pressed.bmp", ;
{ || MsgInfo("Button Clicked!") }, oWnd, "Click Me" )

// Set a tooltip for the button
oBtn:cToolTip := "Click this button to perform an action."

// Disable the button
oBtn:Disable()

// Enable the button
oBtn:Enable()
```

---

This class is highly customizable and can be used to create visually appealing buttons with various states and styles. It is particularly useful in applications where buttons need to display images and text in different layouts.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TBtnFlat documentation:
### Class Documentation: `TBtnFlat`

#### Overview
The `TBtnFlat` class is a custom control class derived from `TControl` in the FiveWin library. It represents a flat button control that can be used in GUI applications. The class provides methods for creating, redefining, and managing the behavior and appearance of the button, including handling user interactions like clicks, key presses, and focus changes.

---

### Class Data Members (CLASSDATA)

1. **`lRegistered`**
- **Type:** `LOGICAL`
- **Description:** A class-level flag indicating whether the class has been registered with the system. This is typically used to ensure that the class is registered only once.

---

### Instance Data Members (DATA)

1. **`nMargin`**
- **Type:** Numeric
- **Initial Value:** `8`
- **Description:** Specifies the margin (in pixels) around the button's text.

2. **`bAction`**
- **Type:** Block (Code Block)
- **Description:** A code block that defines the action to be executed when the button is clicked.

3. **`lWorking`**
- **Type:** Logical
- **Description:** A flag indicating whether the button is currently processing an action.

4. **`lBtnUp`**
- **Type:** Logical
- **Description:** A flag indicating whether the mouse button has been released.

5. **`lBtnDown`**
- **Type:** Logical
- **Description:** A flag indicating whether the mouse button is pressed down.

6. **`lPressed`**
- **Type:** Logical
- **Description:** A flag indicating whether the button is currently in a pressed state.

7. **`lProcessing`**
- **Type:** Logical
- **Initial Value:** `.F.`
- **Description:** A flag indicating whether the button is currently processing an event.

8. **`lBorder`**
- **Type:** Logical
- **Initial Value:** `.F.`
- **Description:** A flag indicating whether the button should have a border.

9. **`lDefault`**
- **Type:** Logical
- **Description:** A flag indicating whether the button is the default button in a dialog.

10. **`nClrTextDis`**
- **Type:** Numeric
- **Initial Value:** `CLR_BLACK`
- **Description:** The color of the button's text when the button is disabled.

11. **`nClrPaneDis`**
- **Type:** Numeric
- **Initial Value:** `CLR_HGRAY`
- **Description:** The color of the button's background when the button is disabled.

---

### Methods

1. **`New( nTop, nLeft, nWidth, nHeight, cPrompt, oWnd, oFont, bAction, bWhen, lUpdate, lBorder, nClrText, nClrPane, lCancel, lDefault )`**
- **Description:** Constructor method for creating a new `TBtnFlat` instance.
- **Parameters:**
- `nTop`, `nLeft`, `nWidth`, `nHeight`: Position and size of the button.
- `cPrompt`: The text displayed on the button.
- `oWnd`: The parent window.
- `oFont`: The font used for the button's text.
- `bAction`: The action to be executed when the button is clicked.
- `bWhen`: A condition that must be true for the button to be clickable.
- `lUpdate`: A flag indicating whether the button should be updated.
- `lBorder`: A flag indicating whether the button should have a border.
- `nClrText`: The color of the button's text.
- `nClrPane`: The color of the button's background.
- `lCancel`: A flag indicating whether the button is a cancel button.
- `lDefault`: A flag indicating whether the button is the default button.
- **Returns:** The newly created `TBtnFlat` instance.

2. **`ReDefine( nId, bAction, oWnd, oFont, lUpdate, bWhen, bValid, cPrompt, lBorder, nClrText, nClrPane, lCancel, lDefault )`**
- **Description:** Redefines an existing button control.
- **Parameters:** Similar to the `New` method, but with an additional `nId` parameter to specify the control ID.
- **Returns:** The redefined `TBtnFlat` instance.

3. **`Initiate( hDlg )`**
- **Description:** Initializes the button control within a dialog.
- **Parameters:** `hDlg`: The handle to the dialog.
- **Returns:** The result of the superclass's `Initiate` method.

4. **`Click()`**
- **Description:** Handles the button click event. Executes the `bAction` code block if the `bWhen` condition is true.
- **Returns:** `nil`.

5. **`Display()`**
- **Description:** Displays the button by calling `BeginPaint`, `Paint`, and `EndPaint`.
- **Returns:** `0`.

6. **`Disable()`**
- **Description:** Disables the button and refreshes its appearance.
- **Returns:** `nil`.

7. **`Enable()`**
- **Description:** Enables the button and refreshes its appearance.
- **Returns:** `nil`.

8. **`Paint()`**
- **Description:** Handles the painting of the button, including text and borders.
- **Returns:** `nil`.

9. **`DrawMultiLine( cText, oFont, nColor, nAlign )`**
- **Description:** Draws multi-line text on the button.
- **Parameters:**
- `cText`: The text to be drawn.
- `oFont`: The font to be used.
- `nColor`: The color of the text.
- `nAlign`: The alignment of the text.
- **Returns:** `nil`.

10. **`LButtonDown( nRow, nCol, nFlags, lTouch )`**
- **Description:** Handles the left mouse button down event.
- **Parameters:**
- `nRow`, `nCol`: The coordinates of the mouse click.
- `nFlags`: Additional flags.
- `lTouch`: A flag indicating whether the event is a touch event.
- **Returns:** `0`.

11. **`LButtonUp( nRow, nCol )`**
- **Description:** Handles the left mouse button up event.
- **Parameters:**
- `nRow`, `nCol`: The coordinates of the mouse release.
- **Returns:** `0`.

12. **`GotFocus( hCtlLost )`**
- **Description:** Handles the event when the button gains focus.
- **Parameters:** `hCtlLost`: The handle of the control that lost focus.
- **Returns:** `nil`.

13. **`LostFocus( hWndGetFocus )`**
- **Description:** Handles the event when the button loses focus.
- **Parameters:** `hWndGetFocus`: The handle of the control that gained focus.
- **Returns:** `nil`.

14. **`KeyChar( nKey, nFlags )`**
- **Description:** Handles key press events.
- **Parameters:**
- `nKey`: The key code.
- `nFlags`: Additional flags.
- **Returns:** `nil`.

15. **`KeyDown( nKey, nFlags )`**
- **Description:** Handles key down events, particularly for navigation keys (e.g., arrow keys).
- **Parameters:**
- `nKey`: The key code.
- `nFlags`: Additional flags.
- **Returns:** `nil`.

16. **`cGenPRG( lDlgUnits )`**
- **Description:** Generates the PRG code for creating the button.
- **Parameters:** `lDlgUnits`: A flag indicating whether to use dialog units.
- **Returns:** A string containing the generated PRG code.

---

### Summary
The `TBtnFlat` class is a versatile flat button control that can be customized in terms of appearance and behavior. It supports various events like clicks, key presses, and focus changes, and provides methods for drawing the button and handling user interactions. The class is designed to be used in FiveWin-based GUI applications, offering flexibility in terms of text, colors, borders, and actions.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TButton documentation:
### Class Documentation: `TButton`

#### Overview
The `TButton` class is a subclass of `TControl` and is designed to represent a button control in a graphical user interface (GUI) application. It provides functionality for creating, managing, and interacting with buttons, including handling click events, focus changes, and key presses. The class is part of the FiveWin library, which is commonly used for developing Windows applications in the xBase language (e.g., Clipper, Harbour).

#### Data Members (DATA)
1. **`bAction`**
- **Type:** Block (Code block)
- **Description:** A code block that defines the action to be executed when the button is clicked. This block typically contains the logic that should run in response to a button click event.

2. **`lDefault`**
- **Type:** Logical (Boolean)
- **Description:** Indicates whether the button is the default button in the window. A default button is typically highlighted and activated when the user presses the Enter key.

3. **`lProcessing`**
- **Type:** Logical (Boolean)
- **Description:** A flag used to prevent multiple simultaneous executions of the button's action. It ensures that the button's action is not triggered again while it is already being processed.

4. **`aEvents`**
- **Type:** Array
- **Description:** A class-level array that defines the events supported by the button. In this case, it includes the `OnClick` event, which is triggered when the button is clicked.

#### Methods (METHOD)

1. **`New( nRow, nCol, cCaption, oWnd, bAction, nWidth, nHeight, nHelpId, oFont, lDefault, lPixel, lDesign, cMsg, lUpdate, bWhen, bValid, lCancel, cVarName, lMultiline, nAddlStyle, lRelPix )`**
- **Description:** Constructor method for creating a new `TButton` instance. It initializes the button with the specified properties such as position, caption, size, and action.
- **Parameters:**
- `nRow`, `nCol`: The row and column positions of the button.
- `cCaption`: The text displayed on the button.
- `oWnd`: The parent window to which the button belongs.
- `bAction`: The code block to execute when the button is clicked.
- `nWidth`, `nHeight`: The width and height of the button.
- `nHelpId`: The help context ID for the button.
- `oFont`: The font used for the button's text.
- `lDefault`: Whether the button is the default button.
- `lPixel`: Whether the coordinates are in pixels.
- `lDesign`: Whether the button is in design mode.
- `cMsg`: The tooltip or message associated with the button.
- `lUpdate`: Whether the button should update its state.
- `bWhen`, `bValid`: Code blocks for validation and enabling/disabling the button.
- `lCancel`: Whether the button is a cancel button.
- `cVarName`: The variable name for the button.
- `lMultiline`: Whether the button supports multiline text.
- `nAddlStyle`: Additional styles for the button.
- `lRelPix`: Whether the coordinates are relative to pixels.

2. **`ReDefine( nId, bAction, oWnd, nHelpId, cMsg, lUpdate, bWhen, bValid, cPrompt, lCancel )`**
- **Description:** Redefines an existing button with new properties. This method is used to modify an already created button.
- **Parameters:**
- `nId`: The ID of the button to redefine.
- `bAction`: The new action to execute when the button is clicked.
- `oWnd`: The parent window.
- `nHelpId`: The new help context ID.
- `cMsg`: The new tooltip or message.
- `lUpdate`: Whether the button should update its state.
- `bWhen`, `bValid`: New validation and enabling/disabling code blocks.
- `cPrompt`: The new caption for the button.
- `lCancel`: Whether the button is a cancel button.

3. **`Click()`**
- **Description:** Handles the button click event. It executes the `bAction` code block if it is defined and not already being processed. It also manages focus and button style changes.

4. **`Refresh( lErase )`**
- **Description:** Refreshes the button's display. If the button is associated with a variable (`bSetGet`), it updates the button's text with the current value of the variable.
- **Parameters:**
- `lErase`: Whether to erase the background before refreshing.

5. **`cGenPRG( lDlgUnits )`**
- **Description:** Generates the source code (PRG) representation of the button, which can be used to recreate the button programmatically.
- **Parameters:**
- `lDlgUnits`: Whether to use dialog units for coordinates.

6. **`GetDlgCode( nLastKey )`**
- **Description:** Determines the dialog code for the button, which controls how the button interacts with keyboard input.
- **Parameters:**
- `nLastKey`: The last key pressed.

7. **`GotFocus( hCtlLost )`**
- **Description:** Handles the event when the button gains focus. It updates the button's style to indicate that it is the default button.
- **Parameters:**
- `hCtlLost`: The handle of the control that lost focus.

8. **`LButtonUp( nRow, nCol, nKeyFlags )`**
- **Description:** Handles the left mouse button up event. It triggers the `OnClick` event if it is defined.
- **Parameters:**
- `nRow`, `nCol`: The coordinates of the mouse pointer.
- `nKeyFlags`: The state of the mouse buttons and keyboard keys.

9. **`LostFocus( hCtlFocus )`**
- **Description:** Handles the event when the button loses focus. It updates the button's style to indicate that it is no longer the default button.
- **Parameters:**
- `hCtlFocus`: The handle of the control that gained focus.

10. **`MouseMove( nRow, nCol, nKeyFlags )`**
- **Description:** Handles the mouse move event. It calls the parent class's `MouseMove` method.
- **Parameters:**
- `nRow`, `nCol`: The coordinates of the mouse pointer.
- `nKeyFlags`: The state of the mouse buttons and keyboard keys.

11. **`cToChar()`**
- **Description:** Converts the button to a string representation. It returns the string "BUTTON".

12. **`Colors()`**
- **Description:** Returns the color settings for the button. In this implementation, it always returns `0`.

13. **`KeyDown( nKey, nFlags )`**
- **Description:** Handles key down events. It processes navigation keys (Up, Down, Left, Right) and the Enter key.
- **Parameters:**
- `nKey`: The key code of the pressed key.
- `nFlags`: Additional flags for the key event.

14. **`Initiate( hDlg )`**
- **Description:** Initializes the button when it is created. It sets the button's default state and updates its caption.
- **Parameters:**
- `hDlg`: The handle of the dialog window.

15. **`SaveToRC( nIndent )`**
- **Description:** Generates a resource script (RC) representation of the button, which can be used to create the button in a resource file.
- **Parameters:**
- `nIndent`: The number of spaces to indent the RC code.

16. **`Html()`**
- **Description:** Generates an HTML representation of the button. This method is currently a placeholder and does not contain any implementation.

#### Additional Notes
- The class includes commented-out code related to skinning and painting, which suggests that the class may have had or may have planned support for custom button appearances.
- The class is designed to be flexible and extensible, allowing for various button styles, actions, and behaviors to be defined at runtime.

This documentation provides a comprehensive overview of the `TButton` class, its data members, and methods, making it easier to understand and use in a FiveWin application.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TButtonBmp documentation:
### Class Documentation: `TButtonBmp`

#### Overview
The `TButtonBmp` class is a specialized button class that extends the functionality of the `TButton` class by adding support for bitmap images. This class allows you to create buttons with custom bitmaps, control the layout of text and images, and handle various button states (e.g., pressed, disabled). It also supports alpha transparency for bitmaps, enabling more visually appealing buttons.

#### Class Hierarchy
- **Parent Class:** `TButton`
- **Child Class:** `TButtonBmp`

#### Class Data Members (DATAs)

1. **`aPalBmp`**
- **Type:** Array
- **Description:** Stores information about the bitmap, including the handle, dimensions, and transparency data.

2. **`cPosText`**
- **Type:** String
- **Description:** Specifies the position of the text relative to the bitmap (e.g., "LEFT", "RIGHT", "TOP", "BOTTOM").

3. **`cLayOut`**
- **Type:** String
- **Description:** Defines the layout of the button, such as the alignment of the bitmap and text.

4. **`bAlphaLevel`**
- **Type:** Code Block
- **Description:** A code block that can be evaluated to determine the alpha level (transparency) of the bitmap.

5. **`hAlphaLevel`**
- **Type:** Numeric
- **Description:** Stores the current alpha level (transparency) of the bitmap.

6. **`lBmpTransparent`**
- **Type:** Logical
- **Description:** Indicates whether the bitmap should be drawn with transparency. Default is `.T.` (true).

7. **`lGDIP`**
- **Type:** Logical
- **Description:** Indicates whether GDI+ is used for rendering the bitmap. Default is `.F.` (false). This is a read-only property.

8. **`bColorMap`**
- **Type:** Code Block
- **Description:** A code block that can be evaluated to apply a color map to the bitmap.

#### Class Methods (METHODs)

1. **`New( nRow, nCol, cCaption, oWnd, bAction, nWidth, nHeight, nHelpId, oFont, lDefault, lPixel, lDesign, cMsg, lUpdate, bWhen, bValid, lCancel, cBitmap, cPosText, cToolTip, lFlat, cLayOut, lGDIP, lRelPix )`**
- **Description:** Constructor method for creating a new `TButtonBmp` instance.
- **Parameters:**
- `nRow`, `nCol`: Position of the button.
- `cCaption`: Text displayed on the button.
- `oWnd`: Parent window.
- `bAction`: Code block to execute when the button is clicked.
- `nWidth`, `nHeight`: Dimensions of the button.
- `nHelpId`: Help ID for the button.
- `oFont`: Font used for the button text.
- `lDefault`: Whether the button is the default button.
- `lPixel`: Whether dimensions are in pixels.
- `lDesign`: Whether the button is in design mode.
- `cMsg`: Tooltip message.
- `lUpdate`: Whether to update the button.
- `bWhen`, `bValid`: Validation code blocks.
- `lCancel`: Whether the button is a cancel button.
- `cBitmap`: Path to the bitmap file.
- `cPosText`: Position of the text relative to the bitmap.
- `cToolTip`: Tooltip text.
- `lFlat`: Whether the button has a flat style.
- `cLayOut`: Layout of the button.
- `lGDIP`: Whether to use GDI+ for rendering.
- `lRelPix`: Whether to use relative pixel positioning.

2. **`ReDefine( nId, bAction, oWnd, nHelpId, cMsg, lUpdate, bWhen, bValid, cPrompt, lCancel, cBitmap, cPosText, cToolTip, lGDIP )`**
- **Description:** Redefines an existing button with new properties.
- **Parameters:** Similar to `New()`, but for redefining an existing button.

3. **`Initiate( hDlg )`**
- **Description:** Initializes the button within a dialog.
- **Parameters:**
- `hDlg`: Handle to the dialog.

4. **`HandleEvent( nMsg, nWParam, nLParam )`**
- **Description:** Handles window messages, particularly `WM_UPDATEUISTATE` to refresh the button when necessary.
- **Parameters:**
- `nMsg`: Message ID.
- `nWParam`, `nLParam`: Message parameters.

5. **`KeyDown( nKey, nFlags )`**
- **Description:** Handles key down events and refreshes the button.
- **Parameters:**
- `nKey`: Key code.
- `nFlags`: Key flags.

6. **`LButtonDown( nRow, nCol, nKeyFlags, lTouch )`**
- **Description:** Handles left mouse button down events and refreshes the button.
- **Parameters:**
- `nRow`, `nCol`: Mouse position.
- `nKeyFlags`: Key flags.
- `lTouch`: Whether the event is a touch event.

7. **`LDblClick( nRow, nCol, nKeyFlags )`**
- **Description:** Handles left mouse button double-click events and refreshes the button.
- **Parameters:**
- `nRow`, `nCol`: Mouse position.
- `nKeyFlags`: Key flags.

8. **`LoadBitmap( cBmpName )`**
- **Description:** Loads a bitmap from a file or resource.
- **Parameters:**
- `cBmpName`: Path to the bitmap file or resource name.

9. **`Paint()`**
- **Description:** Paints the button, including the bitmap and text, based on the current state and layout.

10. **`Release()`**
- **Description:** Releases the bitmap resources associated with the button.

11. **`Destroy()`**
- **Description:** Destroys the button, releasing all resources.

12. **`EraseBkGnd()`**
- **Description:** Handles background erasure. Returns `1` to indicate that the background was handled.

13. **`Enable()`**
- **Description:** Enables the button and refreshes its appearance.

14. **`Disable()`**
- **Description:** Disables the button and refreshes its appearance.

15. **`HasAlpha()`**
- **Description:** Returns whether the bitmap has an alpha channel (transparency).

16. **`nAlphaLevel( uNew )`**
- **Description:** Gets or sets the alpha level (transparency) of the bitmap.
- **Parameters:**
- `uNew`: New alpha level to set (optional).

17. **`SetText( cText )`**
- **Description:** Sets the button's text and refreshes the button.
- **Parameters:**
- `cText`: New text to display on the button.

#### Additional Notes
- The class supports various styles and layouts for the button, including flat buttons, multi-line text, and custom bitmap positioning.
- The `LoadBitmap` method is crucial for loading and managing bitmap resources, and it supports GDI+ for enhanced rendering capabilities.
- The `Paint` method is responsible for rendering the button's appearance, including the bitmap and text, based on the current state and layout settings.

This class is ideal for creating visually rich buttons with custom graphics and advanced layout options in a Windows application.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TC5Tooltip documentation:
### Class Documentation: `TC5ToolTip`

#### Overview
The `TC5ToolTip` class is a custom tooltip window class derived from `TWindow` in the FiveWin library. It provides a flexible and customizable tooltip window that can display headers, footers, body text, and images. The class supports various visual customizations, including gradients, borders, and rounded corners. It also includes methods for handling events, resizing, and painting the tooltip window.

#### Class Data Members (DATA)

1. **`lRegistered`** (Class Data)
- **Type:** LOGICAL
- **Description:** Indicates whether the class has been registered.

2. **`lSplitHdr`**
- **Type:** LOGICAL
- **Description:** Indicates whether the header is split.

3. **`lLeft`**
- **Type:** LOGICAL
- **Description:** Indicates whether the tooltip has a left-aligned section.

4. **`lLineHeader`**
- **Type:** LOGICAL
- **Description:** Indicates whether a line should be drawn in the header.

5. **`lLineFoot`**
- **Type:** LOGICAL
- **Description:** Indicates whether a line should be drawn in the footer.

6. **`lBorder`**
- **Type:** LOGICAL
- **Description:** Indicates whether the tooltip should have a border.

7. **`lBtnClose`**
- **Type:** LOGICAL
- **Description:** Indicates whether a close button is present.

8. **`cHeader`**
- **Type:** CHARACTER
- **Description:** The text to be displayed in the header.

9. **`cBmpLeft`**
- **Type:** CHARACTER
- **Description:** The path to the bitmap image to be displayed on the left side.

10. **`cBody`**
- **Type:** CHARACTER
- **Description:** The text to be displayed in the body.

11. **`cBmpFoot`**
- **Type:** CHARACTER
- **Description:** The path to the bitmap image to be displayed in the footer.

12. **`cFoot`**
- **Type:** CHARACTER
- **Description:** The text to be displayed in the footer.

13. **`lRightAlignBody`**
- **Type:** LOGICAL
- **Description:** Indicates whether the body text should be right-aligned.

14. **`cLibHeader`**
- **Type:** CHARACTER
- **Description:** Library or resource for the header.

15. **`cBmpHeader`**
- **Type:** CHARACTER
- **Description:** The path to the bitmap image to be displayed in the header.

16. **`cLibLeft`**
- **Type:** CHARACTER
- **Description:** Library or resource for the left side image.

17. **`cLibFoot`**
- **Type:** CHARACTER
- **Description:** Library or resource for the footer.

18. **`cTumbNail`**
- **Type:** CHARACTER
- **Description:** The path to the thumbnail image.

19. **`cHeader2`**
- **Type:** CHARACTER
- **Description:** Additional header text.

20. **`nClrPane2`**
- **Type:** NUMERIC
- **Description:** The secondary background color.

21. **`nClrBorder`**
- **Type:** NUMERIC
- **Description:** The border color.

22. **`nClrSepara1`**
- **Type:** NUMERIC
- **Description:** The primary separator color.

23. **`nClrSepara2`**
- **Type:** NUMERIC
- **Description:** The secondary separator color.

24. **`nClrTextHeader`**
- **Type:** NUMERIC
- **Description:** The header text color.

25. **`nClrTextBody`**
- **Type:** NUMERIC
- **Description:** The body text color.

26. **`nClrTextFoot`**
- **Type:** NUMERIC
- **Description:** The footer text color.

27. **`oFontHdr`**
- **Type:** OBJECT
- **Description:** The font used for the header.

28. **`oFontHdr2`**
- **Type:** OBJECT
- **Description:** The font used for the secondary header.

29. **`oFontBody`**
- **Type:** OBJECT
- **Description:** The font used for the body.

30. **`oFontPie`**
- **Type:** OBJECT
- **Description:** The font used for the footer.

31. **`aHeader`**
- **Type:** ARRAY
- **Description:** The coordinates of the header section.

32. **`aHeader2`**
- **Type:** ARRAY
- **Description:** The coordinates of the secondary header section.

33. **`aBody`**
- **Type:** ARRAY
- **Description:** The coordinates of the body section.

34. **`aLeft`**
- **Type:** ARRAY
- **Description:** The coordinates of the left section.

35. **`aRight`**
- **Type:** ARRAY
- **Description:** The coordinates of the right section.

36. **`aFoot`**
- **Type:** ARRAY
- **Description:** The coordinates of the footer section.

37. **`aBtnClose`**
- **Type:** ARRAY
- **Description:** The coordinates of the close button.

38. **`nWRadio`**
- **Type:** NUMERIC
- **Description:** The horizontal radius for rounded corners.

39. **`nHRadio`**
- **Type:** NUMERIC
- **Description:** The vertical radius for rounded corners.

40. **`nGetColor`**
- **Type:** NUMERIC
- **Description:** The color used for getting focus.

41. **`aOldPos`**
- **Type:** ARRAY
- **Description:** The old position of the tooltip.

42. **`nOldRow`**
- **Type:** NUMERIC
- **Description:** The old row position.

43. **`nOldCol`**
- **Type:** NUMERIC
- **Description:** The old column position.

44. **`hRgn`**
- **Type:** HANDLE
- **Description:** The handle to the region used for rounded corners.

45. **`nMResize`**
- **Type:** NUMERIC
- **Description:** The resize mode.

46. **`bBmpLeft`**
- **Type:** BLOCK
- **Description:** A code block to generate the left-side bitmap.

47. **`nFixWidth`**
- **Type:** NUMERIC
- **Description:** The fixed width of the tooltip.

48. **`nFixHeight`**
- **Type:** NUMERIC
- **Description:** The fixed height of the tooltip.

49. **`bOwnerDraw`**
- **Type:** BLOCK
- **Description:** A code block for custom drawing.

50. **`oTimer`**
- **Type:** OBJECT
- **Description:** The timer object for auto-hiding the tooltip.

51. **`nTimer`**
- **Type:** NUMERIC
- **Description:** The interval for the auto-hide timer.

52. **`lShowAgain`**
- **Type:** LOGICAL
- **Description:** Indicates whether the tooltip should be shown again.

#### Class Methods (METHOD)

1. **`New( nTop, nLeft, nWidth, nHeight, oWnd, lDisenio, nClrPane, nClrPane2, nClrText, nWRadio, nHRadio )`**
- **Description:** Constructor method. Initializes the tooltip window with the specified position, size, and colors.
- **Parameters:**
- `nTop`, `nLeft`, `nWidth`, `nHeight`: Position and size of the tooltip.
- `oWnd`: Parent window.
- `lDisenio`: Design flag.
- `nClrPane`, `nClrPane2`: Background colors.
- `nClrText`: Text color.
- `nWRadio`, `nHRadio`: Rounded corner radii.

2. **`Default( lShowDlg )`**
- **Description:** Sets default properties for the tooltip, including rounded corners.
- **Parameters:**
- `lShowDlg`: Flag to show the dialog.

3. **`Destroy()`**
- **Description:** Destroys the tooltip window, releasing resources.

4. **`EndPaint()`**
- **Description:** Ends the painting process.

5. **`Display()`**
- **Description:** Displays the tooltip by painting it.

6. **`Paint()`**
- **Description:** Paints the tooltip window, including headers, footers, and body.

7. **`PaintHdr( hDC, rc )`**
- **Description:** Paints the header section of the tooltip.
- **Parameters:**
- `hDC`: Device context handle.
- `rc`: Rectangle coordinates.

8. **`PaintHdr2( hDC, rc )`**
- **Description:** Paints the secondary header section of the tooltip.
- **Parameters:**
- `hDC`: Device context handle.
- `rc`: Rectangle coordinates.

9. **`PaintBody( hDC, rc )`**
- **Description:** Paints the body section of the tooltip.
- **Parameters:**
- `hDC`: Device context handle.
- `rc`: Rectangle coordinates.

10. **`PaintFoot( hDC, rc )`**
- **Description:** Paints the footer section of the tooltip.
- **Parameters:**
- `hDC`: Device context handle.
- `rc`: Rectangle coordinates.

11. **`HandleEvent( nMsg, nWParam, nLParam )`**
- **Description:** Handles window events.
- **Parameters:**
- `nMsg`: Message type.
- `nWParam`, `nLParam`: Message parameters.

12. **`ReSize( nSizeType, nWidth, nHeight )`**
- **Description:** Handles resizing of the tooltip window.
- **Parameters:**
- `nSizeType`: Resize type.
- `nWidth`, `nHeight`: New dimensions.

13. **`lHeader()`**
- **Description:** Checks if the header is non-empty.
- **Returns:** Logical value indicating whether the header is non-empty.

14. **`lFoot()`**
- **Description:** Checks if the footer is non-empty.
- **Returns:** Logical value indicating whether the footer is non-empty.

15. **`GetSize()`**
- **Description:** Calculates and returns the size of the tooltip.
- **Returns:** An array containing the width and height of the tooltip.

16. **`SetSize( nWidth, nHeight )`**
- **Description:** Sets the size of the tooltip.
- **Parameters:**
- `nWidth`, `nHeight`: New dimensions.

#### Static Function

1. **`Line( hDC, nTop, nLeft, nBottom, nRight, nColor, nWidth )`**
- **Description:** Draws a line on the specified device context.
- **Parameters:**
- `hDC`: Device context handle.
- `nTop`, `nLeft`, `nBottom`, `nRight`: Line coordinates.
- `nColor`: Line color.
- `nWidth`: Line width.

### Summary
The `TC5ToolTip` class is a versatile tooltip window class that supports various customizations, including text, images, gradients, and rounded corners. It provides methods for handling events, resizing, and painting the tooltip, making it suitable for creating visually appealing and interactive tooltips in FiveWin applications.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TCallInfo documentation:
### Documentation for `TCalInfo` Class

The `TCalInfo` class is a part of a calendar management system, likely used in a FiveWin application. It represents an event or appointment in a calendar, with properties and methods to manage its appearance, behavior, and interaction within the calendar view. The class inherits from `TControl`, which suggests it is a visual component that can be rendered on the screen.

---

### **DATA Members**

1. **`nID` (NUMERIC)**
A unique identifier for each instance of `TCalInfo`. It is auto-incremented using the `GetNewId()` method.

2. **`Cargo`**
A generic data holder that can store any additional information related to the calendar event.

3. **`aGradColor` (ARRAY)**
Stores gradient color information for the event's background when it is in a normal state.

4. **`aGradColorND` (ARRAY)**
Stores gradient color information for the event's background when it is marked as "No Disponible" (Not Available).

5. **`aGradColorAp` (ARRAY)**
Stores gradient color information for the event's background when it is marked as "Aplicado" (Applied).

6. **`aGradColorBT` (ARRAY)**
Stores gradient color information for the event's background when it is marked as "Bloqueo/Descanso Terapeutas" (Therapist Block/Rest).

7. **`aCoords` (ARRAY)**
Stores the coordinates (top, left, bottom, right) of the event's bounding box on the calendar.

8. **`nStart` (NUMERIC)**
The start time of the event.

9. **`nEnd` (NUMERIC)**
The end time of the event. Defaults to `nStart` if not provided.

10. **`dStart` (DATE)**
The start date of the event.

11. **`dEnd` (DATE)**
The end date of the event. Defaults to `dStart` if not provided.

12. **`cText` (STRING)**
The body text or description of the event.

13. **`cSubject` (STRING)**
The subject or title of the event.

14. **`nIdx` (NUMERIC)**
A custom index for the event.

15. **`nStatus` (NUMERIC)**
The status of the event (e.g., pending, completed).

16. **`nMinutes` (NUMERIC)**
The duration of the event in minutes.

17. **`lRemember` (LOGICAL)**
A flag indicating whether the event should be remembered or highlighted.

18. **`lND` (LOGICAL)**
A flag indicating whether the event is marked as "No Disponible" (Not Available).

19. **`lAplicado` (LOGICAL)**
A flag indicating whether the event is marked as "Aplicado" (Applied).

20. **`lBloqueoT` (LOGICAL)**
A flag indicating whether the event is marked as "Bloqueo/Descanso Terapeutas" (Therapist Block/Rest).

21. **`lSelected` (LOGICAL)**
A flag indicating whether the event is currently selected.

22. **`lCreated` (LOGICAL)**
A flag indicating whether the event has been created and initialized.

23. **`lVisible` (LOGICAL)**
A flag indicating whether the event is visible on the calendar.

24. **`nClrText` (NUMERIC)**
The color of the text displayed for the event.

25. **`oCalex` (OBJECT)**
A reference to the parent calendar object (`oCalex`).

26. **`oLast` (OBJECT)**
A reference to the last `TCalInfo` object included in the calendar.

27. **`nFlags` (NUMERIC)**
Additional flags or properties for the event.

28. **`oFont` (OBJECT)**
The font used to render the event's text.

---

### **METHODS**

1. **`New( oCalex, nStart, nEnd, dStart, dEnd, cText, cSubject, nClrText, aGradColor, aGradColorND, lND, lAplicado, lBloqueoT, aGradColorAp )`**
Constructor method for the `TCalInfo` class. Initializes the event with the provided parameters, such as start/end times, dates, text, subject, colors, and flags. Default values are assigned if parameters are not provided.

2. **`BuildDates( nTop, nLeft, nWidth, nHeight )`**
Sets the coordinates of the event's bounding box and marks the event as created and visible.

3. **`GetNewId()`**
Generates a unique ID for the event. The ID is auto-incremented and resets after reaching 10000.

4. **`Hide()`**
Hides the event by setting `lVisible` to `.F.`.

5. **`Move( nTop, nLeft, nRight, nBottom )`**
Updates the coordinates of the event's bounding box and ensures the event is only visible if it falls within the calendar's visible area.

6. **`Paint( hDC )`**
Renders the event on the provided device context (`hDC`). Calls `PaintOnMonth()` for rendering.

7. **`PaintOnMonth( hDC )`**
Handles the rendering of the event in the month view of the calendar. It draws the event's background, text, and other visual elements.

8. **`PaintOnWeek( hDC )`**
Calls `PaintOnMonth()` for rendering in the week view. This method is a placeholder and does not have unique logic.

9. **`Show()`**
Makes the event visible by setting `lVisible` to `.T.`.

10. **`LButtonDown( nRow, nCol )`**
Handles the left mouse button click event. It selects the event and updates the calendar's state to reflect the selection.

---

### **Description of Key Functionality**

- **Event Initialization**: The `New()` method initializes the event with default or provided values, including start/end times, dates, text, subject, and visual properties like colors and flags.

- **Rendering**: The `PaintOnMonth()` method is responsible for rendering the event in the calendar's month view. It uses gradient colors for the background, draws the event's text, and handles special cases like "No Disponible," "Aplicado," and "Bloqueo/Descanso Terapeutas."

- **Visibility Management**: The `Hide()` and `Show()` methods control the visibility of the event, while the `Move()` method ensures the event is only rendered if it falls within the visible area of the calendar.

- **Selection Handling**: The `LButtonDown()` method handles the selection of the event when the user clicks on it. It updates the calendar's state to reflect the selected event.

- **Unique ID Generation**: The `GetNewId()` method ensures each event has a unique identifier, which is useful for tracking and managing events in the calendar.

---

### **Usage Example**

```xBase
// Create a new calendar event
oEvent := TCalInfo():New( oCalex, 9, 10, Date(), Date(), "Meeting with Client", "Client Meeting", 0, { {1, nRGB(225, 255, 255), nRGB(181, 202, 230)} }, .F., .F., .F. )

// Set the event's position and size
oEvent:BuildDates( 100, 200, 150, 50 )

// Render the event
oEvent:Paint( hDC )

// Handle a click on the event
oEvent:LButtonDown( 110, 210 )
```

This class is designed to be flexible and extensible, allowing for customization of event appearance and behavior based on the application's requirements.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: Using new Class TDeepSeek for documenting

Post by Antonio Linares »

FWH Class TChatgpt documentation (we recommend using the new and much enhanced Class TOpenAI)
### Class Documentation: `TChatgpt`

The `TChatgpt` class is designed to interact with the OpenAI API, specifically for sending prompts to the ChatGPT model and receiving responses. It encapsulates the functionality required to initialize a connection, send requests, handle responses, and clean up resources. The class uses the `hbcurl` library (a Harbour binding for libcurl) to manage HTTP requests.

---

### **DATA Members**

1. **`cKey`**
- **Type**: `CHARACTER`
- **Initial Value**: `""`
- **Description**: Stores the API key required for authentication with the OpenAI API.

2. **`hCurl`**
- **Type**: `HANDLE` (libcurl handle)
- **Description**: A handle to the libcurl session used for making HTTP requests.

3. **`nHttpCode`**
- **Type**: `NUMERIC`
- **Description**: Stores the HTTP response code returned by the OpenAI API after a request.

4. **`nError`**
- **Type**: `NUMERIC`
- **Initial Value**: `0`
- **Description**: Stores the error code returned by libcurl after performing a request. A value of `HB_CURLE_OK` indicates success.

5. **`cResponse`**
- **Type**: `CHARACTER`
- **Description**: Stores the raw JSON response received from the OpenAI API.

6. **`cPrompt`**
- **Type**: `CHARACTER`
- **Description**: Stores the user-provided prompt that will be sent to the ChatGPT model.

7. **`cModel`**
- **Type**: `CHARACTER`
- **Initial Value**: `"gpt-4o-mini"`
- **Description**: Specifies the ChatGPT model to be used for generating responses.

8. **`cUrl`**
- **Type**: `CHARACTER`
- **Initial Value**: `"https://api.openai.com/v1/chat/completions"`
- **Description**: The URL endpoint for the OpenAI API's chat completions.

---

### **METHODS**

1. **`New( cKey )`**
- **Purpose**: Constructor method to initialize the `TChatgpt` object.
- **Parameters**:
- `cKey`: The API key for authenticating with the OpenAI API.
- **Description**: Initializes the `cKey` and sets up a new libcurl session using `curl_easy_init()`.
- **Returns**: The initialized object (`Self`).

2. **`Send()`**
- **Purpose**: Sends a prompt to the OpenAI API and retrieves the response.
- **Description**:
- Configures the libcurl session with the necessary options (e.g., URL, headers, POST data).
- Constructs a JSON payload containing the model and prompt.
- Executes the request using `curl_easy_perform()`.
- Captures the HTTP response code and the raw JSON response.
- **Returns**: The raw JSON response (`::cResponse`).

3. **`Reset()`**
- **Purpose**: Resets the libcurl session and clears the response data.
- **Description**:
- Resets the libcurl handle using `curl_easy_reset()`.
- Clears the `nError` and `cResponse` fields.
- **Returns**: `nil`.

4. **`End()`**
- **Purpose**: Cleans up the libcurl session and releases resources.
- **Description**:
- Closes the libcurl session using `curl_easy_cleanup()`.
- Sets the `hCurl` handle to `nil`.
- **Returns**: `nil`.

5. **`GetValue()`**
- **Purpose**: Extracts specific values from the JSON response.
- **Description**:
- Decodes the JSON response into a Harbour hash.
- Iterates through the provided keys to extract nested values.
- Handles errors gracefully using a `TRY...CATCH` block.
- **Returns**: The extracted value from the JSON response.

---

### **Usage Example**

```harbour
// Initialize the TChatgpt object with your API key
oChat := TChatgpt():New( "your-api-key-here" )

// Set the prompt
oChat:cPrompt := "What is the capital of France?"

// Send the request and get the response
cResponse := oChat:Send()

// Extract a specific value from the response
cCapital := oChat:GetValue( "choices", "message", "content" )

// Display the result
? "The capital of France is:", cCapital

// Clean up resources
oChat:End()
```

---

### **Notes**
- The class assumes the use of the `hbcurl` library for HTTP requests. Ensure the library is properly installed and configured.
- The `GetValue` method is designed to handle nested JSON structures, but it may require adjustments based on the specific structure of the API response.
- Error handling is minimal in this implementation. Consider extending it to handle specific HTTP or libcurl errors more robustly.

This class provides a simple and reusable interface for interacting with the OpenAI ChatGPT API in Harbour applications.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply