Function Reference


_GUIToolTip_SetTitle

Adds a standard icon and title string

#include <GuiToolTip.au3>
_GUIToolTip_SetTitle ( $hTool, $sTitle [, $iIcon = 0] )

Parameters

$hTool Handle to the ToolTip control (returned by _GUIToolTip_Create.)
$sTitle Title string
$iIcon [optional] Set to one of the values below:.
    $TTI_NONE (0) - No icon [default]
    $TTI_INFO (1) - Information icon
    $TTI_WARNING (2) - Warning icon
    $TTI_ERROR (3) - Error Icon
    $TTI_INFO_LARGE (4) - Large Information Icon
    $TTI_WARNING_LARGE (5) - Large Warning Icon
    $TTI_ERROR_LARGE (6) - Large Error Icon

Return Value

Success: True.
Failure: False.

Remarks

As of Windows XP SP2 and later, $iIcon can contain an HICON value. Any value greater than 3 is assumed to be an HICON.
The title of a tooltip appears above the text, in a different font. It is not sufficient to have a title; the tooltip must have text as well, or it is not displayed.
A title with an Icon but no text in the title won't display a title or the icon. You have to set the text of the title, even if it's only one character, if you plan on using an icon.
The string entered in $sTitle must not exceed 99 characters in length.

Related

_GUIToolTip_GetTitleText, _GUIToolTip_UpdateTipText

Example

Example 1

#include "Extras\HelpFileInternals.au3"

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

Example()

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

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

    _MemoCreate(4, 68, 444, 196)

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

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

    ; Set the title of the tooltip
    _GUIToolTip_SetTitle($hToolTip, 'This is the ToolTip title', $TTI_INFO)

    GUISetState(@SW_SHOW)

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

    _MemoMsgBox($MB_SYSTEMMODAL, "ToolTip Title =", _GUIToolTip_GetTitleText($hToolTip))
    _MemoMsgBox($MB_SYSTEMMODAL, "Tooltip Text =", _GUIToolTip_GetText($hToolTip, $hGUI, $hButton))

    _MemoMsgBoxStatus("", -1, $hGUI) ; no more action, wait GUI for closing

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

Example 2 : ToolTip Set Title to an External process

#include "Extras\HelpFileInternals.au3"

#include <GUIToolTip.au3>

Example()

Func Example()
    Local $sFromTo
    Local $hWin = _MemoRunAU3OutProcess($sFromTo) ; OK also in "same mode"
    _MemoCreateOutProcess($hWin, "Button", 2, $sFromTo)

    Local $hToolTip = _MemoGetHandleInProcess()

    ; Set the title of the tooltip
    _GUIToolTip_SetTitle($hToolTip, '>>>New Title Text', $TTI_WARNING)
    If @error Then
        _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_SetTitle()" & " @error = " & @error & @CRLF & _
                @TAB & "cannot be accessed from an external process" & @CRLF & _
                @TAB & "running in different mode")
    Else
        _MemoMsgBox($MB_SYSTEMMODAL, "ToolTip Title" & $sFromTo, _GUIToolTip_GetTitleText($hToolTip))
    EndIf

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

EndFunc   ;==>Example