UDF > GUI > GuiToolTip >


_GUIToolTip_GetToolCount

Retourne le nombre d'éléments déclencheurs associés à un contrôle info-bulle

#include <GuiToolTip.au3>
_GUIToolTip_GetToolCount ( $hWnd )

Paramètre

$hWnd Handle du contrôle info-bulle (retourné par _GUIToolTip_Create.)

Valeur de retour

Retourne le nombre d'éléments gérés par le contrôle info-bulle.

Exemple

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

Example()

Func Example()
    Local $hGUI = GUICreate(StringTrimRight(@ScriptName, 4), 270, 200)

    Local $idAdd = GUICtrlCreateButton("Get Count 1", 30, 32, 75, 25)
    Local $hAdd = GUICtrlGetHandle($idAdd)
    Local $idButton_Clear = GUICtrlCreateButton("Get Count 2", 30, 72, 75, 25)
    Local $hButton_Clear = GUICtrlGetHandle($idButton_Clear)
    Local $idMylist = GUICtrlCreateList("Item 1", 120, 32, 121, 97)
    Local $hMylist = GUICtrlGetHandle($idMylist)
    Local $idButton_Close = GUICtrlCreateButton("Exit button", 80, 150, 110, 28)
    Local $hButton_Close = GUICtrlGetHandle($idButton_Close)

    ; Crée 2 contrôles info-bulles
    Local $hToolTip1 = _GUIToolTip_Create(0, BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON)); Info-bulle de style balloon
    Local $hToolTip2 = _GUIToolTip_Create(0) ; Info-bulle de style par défaut
    _GUIToolTip_SetMaxTipWidth($hToolTip2, 100) ; Permet des bulles multilignes avec $hToolTip2

    ; Ajoute des outils aux contrôles info-bulle
    ; 3 éléments pour $hToolTip1
    _GUIToolTip_AddTool($hToolTip1, 0, "Click to display the # of tools assigned to $hToolTip1", $hAdd)
    _GUIToolTip_AddTool($hToolTip1, 0, "Exit the script", $hButton_Close)
    _GUIToolTip_AddTool($hToolTip1, 0, "The listbox", $hMylist)
    ; 2 éléments pour $hToolTip2
    _GUIToolTip_AddTool($hToolTip2, 0, "Click to display the # of tools assigned to $hToolTip2", $hButton_Clear)
    _GUIToolTip_AddTool($hToolTip2, 0, "Multiline tooltip" & @CRLF & "for the GUI", $hGUI) ; Info-bulle multiligne 
    GUISetState(@SW_SHOW)

    Local $iMsg
    Do
        $iMsg = GUIGetMsg()
        If $iMsg = $idAdd Then
            MsgBox($MB_SYSTEMMODAL, "Tool count", "Number of tools:" & @TAB & _GUIToolTip_GetToolCount($hToolTip1))
        ElseIf $iMsg = $idButton_Clear Then
            MsgBox($MB_SYSTEMMODAL, "Tool count", "Number of tools:" & @TAB & _GUIToolTip_GetToolCount($hToolTip2))
        EndIf
    Until $iMsg = $idButton_Close Or $iMsg = $GUI_EVENT_CLOSE

    ; Détruit les contrôles infobulles
    _GUIToolTip_Destroy($hToolTip1)
    _GUIToolTip_Destroy($hToolTip2)
    GUIDelete($hGUI)
EndFunc   ;==>Example