Funktionreferenz


_GUIToolTip_AddTool

Beschreibung anzeigen in

Registriert ein Tool mit dem ToolTip-Control

#include <GuiToolTip.au3>
_GUIToolTip_AddTool ( $hTool, $hWnd, $sText [, $iID = 0 [, $iLeft = 0 [, $iTop = 0 [, $iRight = 0 [, $iBottom = 0 [, $iFlags = Default [, $iParam = 0]]]]]]] )

Parameter

$hTool Handle des ToolTip-Controls (zurückgegeben durch _GUIToolTip_Create.)
$hWnd Handle zum Fenster welches das Tool enthält oder 0
$sText Text für das ToolTip-Control. Siehe Bemerkungen.
$iID [optional] ID des Tools oder Fenster Handle des Controls das zu Tool zugewiesen wurde
$iLeft [optional] X Koordinate der oberen linken Ecke des Rechtecks
$iTop [optional] Y Koordinate der oberen linken Ecke des Rechtecks
$iRight [optional] X Koordinate der unteren rechten Ecke des Rechtecks
$iBottom [optional] Y Koordinate der unteren rechten Ecke des Rechtecks
$iFlags [optional] Flags welche die ToolTip Anzeige steuern:
$TTF_IDISHWND - Zeigt an, dass $iID das Fenster Handle des Tools anstatt der ID ist
$TTF_CENTERTIP - Zentriert das Fenster, zugehörig zu dem durch $iID festgelegten Tool
$TTF_RTLREADING - Zeigt an, dass der Text in umgekehrter Richtung angezeigt werden soll
$TTF_SUBCLASS - Zeigt an, dass das Control das Fenster des Tool unterklassifizieren soll
$TTF_TRACK - Positioniert das Control neben dem zugehörigen Tool
$TTF_ABSOLUTE - Positioniert das Fenster bei den gleichen Koordinaten wie TTM_TRACKPOSITION
$TTF_TRANSPARENT- Sorgt dafür, dass das Control die Nachrichten an das Elternfenster weiterleitet
$TTF_PARSELINKS - Zeigt an, dass links im Control Text ausgegeliedert sein sollte
Voreinstellung = BitOr($TTF_SUBCLASS, $TTF_IDISHWND)
$iParam [optional] Anwendungsspezifischer Wert der mit dem Tool verknüpft ist

Die Konstanten sind in ToolTipConstants.au3 definiert

Rückgabewert

Erfolg: True.
Fehler: False.

Bemerkungen

Falls ein Benachrichtigungs-Callback benötigt wird, so ist $sText = -1 (LPSTR_TEXTCALLBACK) festzulegen.

Wenn der $TTF_IDISHWND Flag benutzt wird, so werden die Koordinaten in $iLeft, $iTop, $iRight und $iBottom ignoriert.

Der $TTF_ABSOLUTE muss mit dem $TTF_TRACK Flag genutzt werden.
Normale Fenster stellen den Text von links nach rechts (LTR) dar. Windows kann den Text jedoch auch gespiegelt darstellen, für Sprachen welche sich von rechts nach links (RTL) lesen wie z.B. Arabisch oder Hebräisch. Normalerweise wird der Text eines Tooltips in der selben Richtung dargestellt wie in seinem Parent Fenster festgelegt.Wenn jedoch $TTF_RTLREADING gesetzt ist, so wird der Text in der entgegengesetzten Richtung angezeigt.

- - - - - - - - Erklärung der Controls - - - - - - - -

Verwandte Funktionen

_GUIToolTip_DelTool

Beispiel

Beispiel 1

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

Example()

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

    Local $idButton = GUICtrlCreateButton("Dies ist ein Button", 30, 32, 130, 28)
    Local $hButton = GUICtrlGetHandle($idButton)
    ; Erstellt ein Tooltip Control mit den Standardeinstellungen
    Local $hToolTip = _GUIToolTip_Create(0)

    ; Fügt dem Tooltip Control ein Tool hinzu
    _GUIToolTip_AddTool($hToolTip, 0, "Dies ist ein ToolTip", $hButton)
    GUISetState(@SW_SHOW)

    While 1
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    ; Zerstört des Tooltip Control
    _GUIToolTip_Destroy($hToolTip)
    GUIDelete($hGUI)
EndFunc   ;==>Example

Beispiel 2

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

; This example demonstrates how to add a tool, it does not assign the tool to any control, just an area of the GUI
Example()

Func Example()
    Local $hGUI = GUICreate(StringTrimRight(@ScriptName, StringLen(".exe")), 350, 200)
    ; create frames to indicate where the tooltip will display when the mouse is in the
    ; correct location on the GUI, these frames do not have a tooltip assigned to it
    ; these frames are ONLY for visual representation as to where the tooltip will display,
    ; they are not needed to make the tooltip display.
    GUICtrlCreateLabel("", 10, 10, 160, 75, $SS_ETCHEDFRAME)
    ; this label control must be disabled or the tooltip will not display when the mouse
    ; is over it.
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("", 10, 84, 160, 75, $SS_ETCHEDFRAME)
    ; this label control must be disabled or the tooltip will not display when the mouse
    ; is over it.
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("", 169, 10, 160, 75, $SS_ETCHEDFRAME)
    ; this label control must be disabled or the tooltip will not display when the mouse
    ; is over it.
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("", 169, 84, 160, 75, $SS_ETCHEDFRAME)
    ; this label control must be disabled or the tooltip will not display when the mouse
    ; is over it.
    GUICtrlSetState(-1, $GUI_DISABLE)
    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)

    ; add 4 tools to the tooltip control, these tools are created using the location on the GUI
    ; rather than assigning them to a specific control.
    _GUIToolTip_AddTool($hToolTip, $hGUI, "Upper Left corner", 0, 10, 10, 168, 85, $TTF_SUBCLASS)
    _GUIToolTip_AddTool($hToolTip, $hGUI, "Upper Right corner", 0, 168, 10, 328, 85, $TTF_SUBCLASS)
    _GUIToolTip_AddTool($hToolTip, $hGUI, "Lower Left corner", 0, 10, 85, 168, 160, $TTF_SUBCLASS)
    _GUIToolTip_AddTool($hToolTip, $hGUI, "Lower Right corner", 0, 168, 85, 328, 160, $TTF_SUBCLASS)
    ; add a tool to the tooltip control that is assigned to the button control
    _GUIToolTip_AddTool($hToolTip, 0, "This tooltip belongs to the button", $hButton)
    GUISetState(@SW_SHOW)

    While 1
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    ; Destroy the tooltip control
    _GUIToolTip_Destroy($hToolTip)
    GUIDelete($hGUI)
EndFunc   ;==>Example