Function Reference


_GUIToolTip_TrackActivate

Activates or deactivates a tracking ToolTip

#include <GuiToolTip.au3>
_GUIToolTip_TrackActivate ( $hTool [, $bActivate = True [, $hWnd = 0 [, $iID = 0]]] )

Parameters

$hTool Handle to the ToolTip control (returned by _GUIToolTip_Create.)
$bActivate [optional] True to activate, False to deactivate
$hWnd [optional] Handle to the window that contains the tool
$iID [optional] Control handle that the tool is assigned to, or application-defined identifier of the tool

Return Value

None.

Remarks

You must use this function to activate a tracking tooltip prior to attempting to update its position using _GUIToolTip_TrackPosition()
If you use _GUIToolTip_TrackPosition() without using _GUIToolTip_TrackActivate() then the tool will only display when the mouse if over the assigned window or control, if applicable.

Related

_GUIToolTip_TrackPosition

Example

Example 1

#include "Extras\HelpFileInternals.au3"

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

Example()

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

    Local $hToolTip = _GUIToolTip_Create(0, $TTS_BALLOON)
    _MemoSetHandleInProcess($hToolTip)

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

;~  $hGUI = 0 ; Is OK
;~  $hButton = 0 ; Is OK

    ; Add tool to the ToolTip control, not using a control or the GUI to link it to
    _GUIToolTip_AddTool($hToolTip, $hGUI, " ", $hButton, 0, 0, 0, 0, $TTF_SUBCLASS)

    _GUIToolTip_SetTitle($hToolTip, 'Mouse position', $TTI_INFO)

    GUISetState(@SW_SHOW)

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

    _GUIToolTip_TrackActivate($hToolTip, True, $hGUI, $hButton)

    Local $aPos, $iOldaPos0, $iOldaPos1
    While 1
        Sleep(10)
        $aPos = MouseGetPos()
        If $aPos[0] <> $iOldaPos0 Or $aPos[1] <> $iOldaPos1 Then
            _GUIToolTip_TrackPosition($hToolTip, $aPos[0] + 10, $aPos[1] + 20)
            _GUIToolTip_UpdateTipText($hToolTip, $hGUI, $hButton, "X: " & $aPos[0] & " Y: " & $aPos[1])
            $iOldaPos0 = $aPos[0]
            $iOldaPos1 = $aPos[1]
        EndIf
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

Example 2 : ToolTip Track Activate 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"
    Local $hButton = _MemoCreateOutProcess($hWin, "Button", 0, $sFromTo)

    Local $hToolTip = _MemoGetHandleInProcess()

    _GUIToolTip_TrackActivate($hToolTip, False, $hWin, $hButton)
    If @error Then
        _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_TrackActivate()" & " @error = " & @error & @CRLF & _
                @TAB & "cannot be accessed from an external process" & @CRLF & _
                @TAB & "running in different mode")
    Else
        _MemoMsgBox($MB_SYSTEMMODAL, "ToolTip TrackActivate" & $sFromTo, "Deactivate")
    EndIf

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

EndFunc   ;==>Example