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 [, $hInst = 0]]]]]]]] )
| $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) Die Konstanten sind in ToolTipConstants.au3 definiert |
| $iParam | [optional] Anwendungsspezifischer Wert der mit dem Tool verknüpft ist |
| $hInst | [optional] Handle für die Instanz, die mit dem Tool verknüpft ist |
| Erfolg: | True. |
| Fehler: | False, @error kann gesetzt sein (siehe Bemerkungen). |
Wenn sich das von $hWnd referenzierte Steuerelement nicht im selben Prozess befindet und beide Prozesse in unterschiedlichen AutoIt-Modi (@AutoItVersion) ausgeführt werden, wird @error auf 6 gesetzt.
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 - - - - - - - -
#include "Extras\HelpFileInternals.au3"
#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>
Example()
Func Example()
Local $hGUI = GUICreate("ToolTip einem Tool hinzufügen v(" & @AutoItVersion & ")", 450, 300, 100, 100)
Local $iGUI = 1
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)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hToolTip = ' & $hToolTip & @CRLF & '>Error code: ' & @error & ' Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console
_MemoSetHandleInProcess($hToolTip)
Local $idButton = GUICtrlCreateButton("Button", 30, 32, 130, 28)
Local $hButton = GUICtrlGetHandle($idButton)
;~ $iGUI = 0 ; ist OK
; Fügt dem Tooltip Control ein Tool hinzu
_GUIToolTip_AddTool($hToolTip, 0, "Dies ist ein ToolTip", $hButton)
_GUIToolTip_AddTool($hToolTip, $iGUI * $hGUI, "Dies ist ein ToolTip"", $hButton)
_GUIToolTip_AddTool($hToolTip, $iGUI * $hGUI, "Dies ist ein Tooltip für die nicht andere Strg-Tasten.", $hGUI)
GUISetState(@SW_SHOW)
; Zeigt den Tooltip an, der mit der Schaltfläche verbunden ist.
Opt("MouseCoordMode", 2)
MouseMove(50, 42, 0)
Sleep(250)
While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
; Zerstört des Tooltip Control
_MemoResetHandleInProcess($hToolTip)
_GUIToolTip_Destroy($hToolTip)
GUIDelete($hGUI)
EndFunc ;==>Example
#include "Extras\HelpFileInternals.au3"
#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("ToolTip AddTool - v(" & @AutoItVersion & ")", 350, 200, 100, 100)
; 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, $hGUI, "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
#include "Extras\HelpFileInternals.au3" #include <GUIToolTip.au3> Example() Func Example() Local $sFromTo Local $hWin = _MemoRunAU3OutProcess($sFromTo, True) ; OK same mode, KO if different mode Local $hToolTip = _MemoGetHandleInProcess() Local $hButton = _MemoCreateOutProcess($hWin, "Button", 0, $sFromTo) ; add a tool to the tooltip control Local $iRet = _GUIToolTip_AddTool($hToolTip, $hWin, "<<<This is a ToolTip", $hButton) If @error Then _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_AddTool()" & " @error = " & @error & @CRLF & _ @TAB & "cannot be added to an external process" & @CRLF & _ @TAB & "running in different mode") Else ; only working if both processes are running in "same mode" _MemoWrite("Info" & $sFromTo & " _GUIToolTip_AddTool() $iRet= " & $iRet) _Memowrite(_GUIToolTip_GetText($hWin, $hToolTip, $hButton)) EndIf _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing, close also OutProcess GUI EndFunc ;==>Example