Function Reference


_GUIToolTip_GetBubbleWidth

Returns the width of a ToolTip control

#include <GuiToolTip.au3>
_GUIToolTip_GetBubbleWidth ( $hTool, $hWnd, $iID [, $iFlags = Default] )

Parameters

$hTool Handle to the ToolTip control (returned by _GUIToolTip_Create.)
$hWnd Handle to the window that contains the tool
$iID Handle of the control that the tool is associated with, or the ID of the tool
$iFlags [optional] Flags that control the ToolTip display
    $TTF_IDISHWND = Indicates that $iID is the window handle to the tool instead of the ID
    $TTF_CENTERTIP = Centers the window below the tool specified by $iID
    $TTF_RTLREADING = Indicates that text will be displayed in the opposite direction
    $TTF_SUBCLASS = Indicates that the control should subclass the tool's window to intercept messages
    $TTF_TRACK = Positions the control next to the tool to which it corresponds
    $TTF_ABSOLUTE = Positions the window at the same coordinates provided by TTM_TRACKPOSITION
    $TTF_TRANSPARENT = Causes the control to forward mouse messages to the parent window
    $TTF_PARSELINKS = Indicates that links in the control text should be parsed
Default = BitOr($TTF_SUBCLASS, $TTF_IDISHWND)

Return Value

Success: the width the ToolTip.
Failure: @error is set (see remark).

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.

This function works correctly only on a tracking tooltip, if the tracking hasn't been activated for the tooltip you will get incorrect values returned.

Related

_GUIToolTip_GetBubbleHeight, _GUIToolTip_GetBubbleSize

Example

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    Local $hGUI = GUICreate("ToolTip Get BubbleWidth - v(" & @AutoItVersion & ")", 450, 300, 100, 100)

    Local $idButton = GUICtrlCreateButton("This is a button", 30, 32, 130, 28)
    Local $hButton = GUICtrlGetHandle($idButton)
    ; create a tooltip control using default settings
    Local $hToolTip = _GUIToolTip_Create(0)

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

    GUISetState(@SW_SHOW)

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

    ; Display the height of the tooltip bubble in pixels
    _MemoMsgBox($MB_SYSTEMMODAL, "Info", "Bubble Width = " & _GUIToolTip_GetBubbleWidth($hToolTip, $hGUI, $hButton) & " Pixels")

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

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