# Function Reference

# _GUIToolTip_AdjustRect

Calculates the text display rectangle from the window rectangle

#include <GuiToolTip.au3>
_GUIToolTip_AdjustRect ( $hTool, ByRef $tRECT [, $bLarger = True] )

## Parameters

$hTool | Handle to the ToolTip control (returned by _GUIToolTip_Create.)
$tRECT | $tagRECT structure that holds a window or text display rectangle
$bLarger | [optional] Value that specifies which operation to perform. If True, $tRECT is used to specify a text display rectangle and it receives the corresponding window rectangle. If False, $tRECT is used to specify a window rectangle and it receives the corresponding text display rectangle.

## Return Value

Returns a $tagRECT structure.

## Remarks

The ToolTip's window rectangle is somewhat larger than the text display rectangle that bounds the ToolTip string.
The window origin is also offset up and to the left from the origin of the text display rectangle.
To position the text display rectangle, you must calculate the corresponding window rectangle and use that rectangle to position the ToolTip.
_GUIToolTip_AdjustRect() handles this calculation for you.
If you set $bLarger to True, _GUIToolTip_AdjustRect() takes the size and position of the desired ToolTip text display rectangle, and passes back the size and position of the ToolTip window needed to display the text in the specified position.
If you set $bLarger to False you can specify a ToolTip window rectangle and _GUIToolTip_AdjustRect() will return the size and position of its text rectangle.

## Example

    #include "Extras\HelpFileInternals.au3"

    #include <GUIConstantsEx.au3>
    #include <GUIToolTip.au3>
    #include <MsgBoxConstants.au3>
    #include <StructureConstants.au3>

    Example()

    Func Example()
        Local $hGUI = GUICreate("ToolTip Adjust Rect Text v(" & @AutoItVersion & ")", 450, 300, 100, 100)

        ; create a tooltip control using default settings
        Local $hToolTip = _GUIToolTip_Create(0)
        _MemoSetHandleInProcess($hToolTip)

        Local $idButton = GUICtrlCreateButton("Button", 30, 32, 130, 28)
        Local $hButton = GUICtrlGetHandle($idButton)

    ;~  $hGUI = 0 ; is OK
        _GUIToolTip_AddTool($hToolTip, $hGUI, "This is the ToolTip text", $hButton)

        GUISetState(@SW_SHOW)

        ; Show the tooltip associated with the button
        Opt("MouseCoordMode", 2)
        MouseMove(60, 42, 0)
        Sleep(250)

        ; Retrieve the text of the tool
        Local $tRect = DllStructCreate($tagRECT)
        Local $aRect[4] = [100, 100, 240, 140]
        DllStructSetData($tRect, "Left", $aRect[0])
        DllStructSetData($tRect, "Top", $aRect[1])
        DllStructSetData($tRect, "Right", $aRect[2])
        DllStructSetData($tRect, "Bottom", $aRect[3])

        Local $bLarger = True
        $tRect = _GUIToolTip_AdjustRect($hToolTip, $tRect, $bLarger)
        $aRect[0] = DllStructGetData($tRect, "Left")
        $aRect[1] = DllStructGetData($tRect, "Top")
        $aRect[2] = DllStructGetData($tRect, "Right")
        $aRect[3] = DllStructGetData($tRect, "Bottom")
        _MemoMsgBox($MB_SYSTEMMODAL, 'Adjust Rect (' & $bLarger & ') = ', _
                "Left = " & $aRect[0] & @CRLF & _
                "Top = " & $aRect[1] & @CRLF & _
                "Right = " & $aRect[2] & @CRLF & _
                "Bottom = " & $aRect[3])

        While 1
            If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
        WEnd

        ; Destroy the tooltip control
        _MemoResetHandleInProcess($hToolTip)
        _GUIToolTip_Destroy($hToolTip)
        GUIDelete($hGUI)
    EndFunc   ;==>Example