Funktionreferenz


_GUIToolTip_Create

Beschreibung anzeigen in

Erstellt ein ToolTip-Control

#include <GuiToolTip.au3>
_GUIToolTip_Create ( $hWnd [, $iStyle = $_TT_ghTTDefaultStyle] )

Parameter

$hWnd Handle des Controls, zu dem das ToolTip-Control gehört. Siehe Bemerkungen
$iStyle [optional] ToolTip Stil:
    $TTS_ALWAYSTIP (0x01) - Bewirkt, dass das ToolTip-Control auch erscheint, wenn der Cursor über einem Tool ist, obwohl das dazugehörige Fenster inaktiv ist. Ohne diesem Stil erscheint der ToolTip nur, wenn das dazugehörige Fenster aktiviert ist.
    $TTS_NOPREFIX (0x02) - Verhindert das automatische Entfernen des "&"-Zeichens aus einem String. Ohne diesen Stil werden automatisch alle im String enthaltenen "&"-Zeichen entfernt. Damit ist es möglich, einen String gleichzeitig als Menütext und als ToolTip-Text zu verwenden.
    $TTS_NOANIMATE (0x10) - Deaktiviert die animierte Darstellung des ToolTips in Windows 2000 Systemen.
    $TTS_NOFADE (0x20) - Deaktiviert das Einblenden des ToolTips in Windows 2000 Systemen.
    $TTS_BALLOON (0x40) - Bewirkt, dass das ToolTip-Control wie eine "Sprechblase" aussieht und mit einer Spitze auf das Item zeigt.
    $TTS_CLOSE (0x80) - Zeigt ein "Schließen"-Icon an, damit die Anzeige des ToolTips abgebrochen werden kann.
Standard: $_TT_ghTTDefaultStyle = BitOr($TTS_ALWAYSTIP, $TTS_NOPREFIX)

Die Konstanten sind in ToolTipConstants.au3 definiert.

Rückgabewert

Erfolg: Das Handle des ToolTip-Fensters
Fehler: 0.

Bemerkungen

$hWnd ist entweder 0, das Handle zum Parentfenster oder des dazugehörigen Fensters welches erstellt wird.
Um ein Childfenster zu erzeugen muss ein gültiger Window Handle übergeben werden.

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

Verwandte Funktionen

_GUIToolTip_Destroy

Beispiel

Beispiel 1

#include "Extras\HelpFileInternals.au3"

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

Example()

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

    Local $idButton_Add = GUICtrlCreateButton("Add", 30, 32, 75, 25)
    Local $hButton_Add = GUICtrlGetHandle($idButton_Add)

    Local $idButton_Clear = GUICtrlCreateButton("Clear", 30, 72, 75, 25)
    Local $hButton_Clear = GUICtrlGetHandle($idButton_Clear)

    Local $idLst_Mylist = GUICtrlCreateList("Item 1", 120, 32, 121, 97)
    Local $hMylist = GUICtrlGetHandle($idLst_Mylist)

    Local $idButton_Close = GUICtrlCreateButton("Exit button", 80, 150, 110, 28)
    Local $hButton_Close = GUICtrlGetHandle($idButton_Close)

    ; Create 2 tooltip controls
    Local $hToolTip1 = _GUIToolTip_Create(0, BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON)) ; balloon style tooltip
    Local $hToolTip2 = _GUIToolTip_Create(0) ; default style tooltip
    _GUIToolTip_SetMaxTipWidth($hToolTip2, 100) ; this allows multiline tooltips to be used with $hToolTip2

;~  $hGUI = 0 ; is OK
    ; add tools to the tooltip controls
    _GUIToolTip_AddTool($hToolTip1, $hGUI, "Adds an item to the list", $hButton_Add)
    _GUIToolTip_AddTool($hToolTip1, $hGUI, "Exit the script", $hButton_Close)
    _GUIToolTip_AddTool($hToolTip1, $hGUI, "The listbox", $hMylist)
    _GUIToolTip_AddTool($hToolTip2, $hGUI, "Clears the list", $hButton_Clear)
    _GUIToolTip_AddTool($hToolTip2, $hGUI, "Multiline tooltip" & @CRLF & "for the GUI", $hGUI) ; Multiline ToolTip

    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $idButton_Add
                GUICtrlSetData($idLst_Mylist, 'The Add button was pressed"|')
            Case $idButton_Clear
                GUICtrlSetData($idLst_Mylist, '')
            Case $idButton_Close, $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    ; Destroy the tooltip controls
    _GUIToolTip_Destroy($hToolTip1)
    _GUIToolTip_Destroy($hToolTip2)
    GUIDelete($hGUI)
EndFunc   ;==>Example

Example (OutProcess) : ToolTip Create to an External process

#include "Extras\HelpFileInternals.au3"

#include <GUIToolTip.au3>

Example()

Func Example()
    Local $sFromTo
    Local $hWin = _MemoRunAU3OutProcess($sFromTo, True)
    Local $hButton = _MemoCreateOutProcess($hWin, "Button", 0, $sFromTo)

    Local $hToolTip2 = _GUIToolTip_Create($hWin)
    If @error Then
        _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_Create()" & " @error = " & @error & @CRLF & _
                @TAB & "cannot be created in an external process")
    Else
        ; should not occur
        _GUIToolTip_AddTool($hToolTip2, $hWin, "<<<This is a ToolTip", $hButton)
        _MemoWrite(">>> _GUIToolTip_GetToolCount() = " & _GUIToolTip_GetToolCount($hToolTip2))
        ; GetToolCount returns 1, but tools are numbered starting from zero (0), so we have to subtract 1
        For $I = 0 To _GUIToolTip_GetToolCount($hToolTip2) - 1
            Local $aTool = _GUIToolTip_EnumTools($hToolTip2, $I)
            ; only working if both processes are running in "same mode"
            _MemoWrite(">>> Tooltip info for tooltip - " & $I & @CRLF & _
                    "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
                    "HWnd: " & @TAB & "0x" & Hex($aTool[1]) & @CRLF & _
                    "ID: " & @TAB & "0x" & Hex($aTool[2]) & @CRLF & _
                    "Left X:" & @TAB & $aTool[3] & @CRLF & _
                    "Left Y:" & @TAB & $aTool[4] & @CRLF & _
                    "Right X:" & @TAB & $aTool[5] & @CRLF & _
                    "Right Y:" & @TAB & $aTool[6] & @CRLF & _
                    "Instance:" & @TAB & $aTool[7] & @CRLF & _
                    "Text:" & @TAB & $aTool[8] & @CRLF & _
                    "lParam:" & @TAB & $aTool[9])
        Next
    EndIf

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

EndFunc   ;==>Example