Function Reference


Creates a ToolTip control

#include <GuiToolTip.au3>
_GUIToolTip_Create ( $hWnd [, $iStyle = $_TT_ghTTDefaultStyle] )


$hWnd Handle to the window that will own the tool tip control. See remarks.
$iStyle [optional] ToolTip style:
$TTS_ALWAYSTIP (0x01)- Indicates that the ToolTip control appears when the cursor is on a tool even if the ToolTip control's owner window is inactive. Without this style, the ToolTip appears only when the tool's owner window is active.
$TTS_NOPREFIX (0x02) - Prevents the system from stripping the ampersand character from a string. Without this style the system automatically strips ampersand characters. This allows an application to use the same string as both a menu item and as text in a ToolTip control.
$TTS_NOANIMATE (0x10) - Disables sliding ToolTip animation.
$TTS_NOFADE (0x20) - Disables fading ToolTip animation.
$TTS_BALLOON (0x40) - Indicates that the ToolTip control has the appearance of a cartoon "balloon"
$TTS_CLOSE (0x80) - Displays a close icon so that the tooltip can be cancelled
Default: $_TT_ghTTDefaultStyle = BitOr($TTS_ALWAYSTIP, $TTS_NOPREFIX)

Return Value

Success: The handle to the Tooltip control.
Failure: 0.


$hWnd is usually set to zero (0), or a handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle.




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


Func Example()
    Local $hGUI = GUICreate(StringTrimRight(@ScriptName, StringLen(".exe")), 270, 200)

    Local $idButton = GUICtrlCreateButton("Add", 30, 32, 75, 25)
    Local $hButton = GUICtrlGetHandle($idButton)
    Local $idClear = GUICtrlCreateButton("Clear", 30, 72, 75, 25)
    Local $hClear = GUICtrlGetHandle($idClear)
    Local $idMylist = GUICtrlCreateList("Item 1", 120, 32, 121, 97)
    Local $hMylist = GUICtrlGetHandle($idMylist)
    Local $idClose = GUICtrlCreateButton("Exit button", 80, 150, 110, 28)
    Local $hClose = GUICtrlGetHandle($idClose)

    ; Create 2 tooltip controls
    Local $hToolTip1 = _GUIToolTip_Create(0, BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON)); balloon style tooltip
    Local $hToolTip2 = _GUIToolTip_Create(0) ; default style tooltip
    _GUIToolTip_SetMaxTipWidth($hToolTip2, 100) ; this allows multiline tooltips to be used with $hToolTip2
    ; add tools to the tooltip controls
    _GUIToolTip_AddTool($hToolTip1, 0, "Adds an item to the list", $hButton)
    _GUIToolTip_AddTool($hToolTip1, 0, "Exit the script", $hClose)
    _GUIToolTip_AddTool($hToolTip1, 0, "The listbox", $hMylist)
    _GUIToolTip_AddTool($hToolTip2, 0, "Clears the list", $hClear)
    _GUIToolTip_AddTool($hToolTip2, 0, "Multiline tooltip" & @CRLF & "for the GUI", $hGUI) ; Multiline ToolTip

    While 1
        Switch GUIGetMsg()
            Case $idButton
                GUICtrlSetData($idMylist, 'The Add button was pressed"|')
            Case $idClear
                GUICtrlSetData($idMylist, '')
            Case $idClose, $GUI_EVENT_CLOSE
    ; Destroy the tooltip controls
EndFunc   ;==>Example