# Function Reference

# _GUIToolTip_UpdateTipText

Sets the ToolTip text for a tool

#include <GuiToolTip.au3>
_GUIToolTip_UpdateTipText ( $hTool, $hWnd, $iID, $sText )

## Parameters

$hTool | Handle to the ToolTip control (returned by _GUIToolTip_Create.)
$hWnd | Handle of the window that contains the tool, or 0
$iID | Identifier of the tool, or Window handle of the control the tool is to be assigned to
$sText | Text for the ToolTip control.

## Return Value

Success: | None.
Failure: | Set @error.

## Remarks

If $hWnd referenced control is not in the same process and both processes run in different AutoIt mode (@AutoItVersion), the @error is set to 6.

## Related

_GUIToolTip_GetText

## Example

### Example 1

    #include "Extras\HelpFileInternals.au3"

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

    Example()

    Func Example()
        Local $hGUI = GUICreate("ToolTip Update TipText v(" & @AutoItVersion & ")", 450, 300, 100, 100)

        ; Create a tooltip control
        Local $hToolTip = _GUIToolTip_Create(0)
        _MemoSetHandleInProcess($hToolTip)

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

    ;~  $hGUI = 0 ; is OK
        ; Add a tool to the tooltip control
        _GUIToolTip_AddTool($hToolTip, $hGUI, "Click this to change tooltip text", $hButton)

        GUISetState(@SW_SHOW)

        Local $bNew = False
        While 1
            Switch GUIGetMsg()
                Case $idButton ; Press the button to change the text of the tooltip
                    $bNew = Not $bNew
                    If $bNew Then
                        _GUIToolTip_UpdateTipText($hToolTip, $hGUI, $hButton, 'New text')
                    Else
                        _GUIToolTip_UpdateTipText($hToolTip, $hGUI, $hButton, "Click this to change tooltip text")
                    EndIf
                Case $GUI_EVENT_CLOSE
                    ExitLoop
            EndSwitch
        WEnd

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

### Example 2 : ToolTip Update TipText to an External process

    #include "Extras\HelpFileInternals.au3"

    #include <GUIToolTip.au3>

    Example()

    Func Example()
        Local $sFromTo
        Local $hWin = _MemoRunAU3OutProcess($sFromTo, True) ; OK same mode, KO if different mode
        Local $hButton = _MemoCreateOutProcess($hWin, "Button", 1, $sFromTo)

        Local $hToolTip = _MemoGetHandleInProcess()

        _GUIToolTip_UpdateTipText($hToolTip, $hWin, $hButton, '<<< text')
        If @error Then
            _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_UpdateTipText()" & " @error = " & @error & @CRLF & _
                    @TAB & "cannot be accessed from an external process" & @CRLF & _
                    @TAB & "running in different mode")
        Else
            ; only working if both processes are running in "same mode"
            Local $aTool = _GUIToolTip_GetToolInfo($hToolTip, $hWin, $hButton)
            _MemoWrite("Tooltip info" & @CRLF & _
                    "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
                    "HWnd: " & @TAB & "0x" & Hex($aTool[1]) & @CRLF & _
                    "ID: " & @TAB & "0x" & Hex($aTool[2]) & @CRLF & _
                    "Left X:" & @TAB & $aTool[3] & @CRLF & _
                    "Left Y:" & @TAB & $aTool[4] & @CRLF & _
                    "Right X:" & @TAB & $aTool[5] & @CRLF & _
                    "Right Y:" & @TAB & $aTool[6] & @CRLF & _
                    "Instance:" & @TAB & $aTool[7] & @CRLF & _
                    "Text:" & @TAB & $aTool[8] & @CRLF & _
                    "lParam:" & @TAB & $aTool[9])
        EndIf

        _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing, close also OutProcess GUI

    EndFunc   ;==>Example