UDF > GUI > GuiStatusBar >


_GUICtrlStatusBar_SetTipText

Définit le texte d'info-bulle pour une partie

#include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetTipText ( $hWnd, $iPart, $sText )

Paramètres

$hWnd Handle du contrôle StatusBar
$iPart Index de base 0, de la partie
$sText Texte du ToolTip

Valeur de retour

Aucune.

Remarque

La barre d'état doit avoir été créée avec le style $SBARS_TOOLTIPS pour permettre les info-bulles.

En relation

_GUICtrlStatusBar_GetTipText

Exemples

Exemple 1

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPIIcons.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
    Local $hGUI, $hIcon, $hStatus
    Local $aParts[4] = [75, 150, 300, 400]

    ; Crée une GUI
    $hGUI = GUICreate("(Example 1) StatusBar Set Tip Text", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create($hGUI, -1, "", $SBARS_TOOLTIPS)

    ; Crée un contrôle memo
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Définit des parties
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Force tip to be shown when text is more than fits in the box", 1)

    ; Définit une icône
    $hIcon = _WinAPI_LoadShell32Icon(23)
    _GUICtrlStatusBar_SetIcon($hStatus, 0, $hIcon)

    ; Définit le texte des tooltips
    _GUICtrlStatusBar_SetTipText($hStatus, 0, "Tip works when only icon in part or text exceeds part")
    _GUICtrlStatusBar_SetTipText($hStatus, 1, "Force tip to be shown when text is more than fits in the box")

    MemoWrite("Hold Mouse Cursor over part to see tip." & @CRLF)

    ; Show text tips
    MemoWrite("Text tip 1 .: " & _GUICtrlStatusBar_GetTipText($hStatus, 0) & @CRLF)
    MemoWrite("Text tip 2 .: " & _GUICtrlStatusBar_GetTipText($hStatus, 1))

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    ; Free icons
    _WinAPI_DestroyIcon($hIcon)
    GUIDelete()
EndFunc   ;==>Example

; Ecrit un message dans le contrôle memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Exemple 2

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
    Local $hGUI, $hStatus
    Local $aParts[4] = [75, 150, 300, 400]

    ; Crée une GUI
    $hGUI = GUICreate("(Example 2) StatusBar Set Tip Text", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create($hGUI, -1, "", $SBARS_TOOLTIPS)

    ; Crée un contrôle memo
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Définit des parties
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Force tip to be shown when text is more than fits in the box", 1)

    ; Définit une icône
    _GUICtrlStatusBar_SetIcon($hStatus, 0, 23, "shell32.dll")

    ; Définit le texte des tooltips
    _GUICtrlStatusBar_SetTipText($hStatus, 0, "Tip works when only icon in part or text exceeds part")
    _GUICtrlStatusBar_SetTipText($hStatus, 1, "Force tip to be shown when text is more than fits in the box")

    MemoWrite("Hold Mouse Cursor over part to see tip." & @CRLF)

    ; Affiche le texte des tooltips
    MemoWrite("Text tip 1 .: " & _GUICtrlStatusBar_GetTipText($hStatus, 0) & @CRLF)
    MemoWrite("Text tip 2 .: " & _GUICtrlStatusBar_GetTipText($hStatus, 1))

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

; Ecrit un message dans le contrôle memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite