Creates a ToolTip control
#include <GuiToolTip.au3>
_GUIToolTip_Create ( $hWnd [, $iStyle = $_TT_ghTTDefaultStyle] )
$hWnd | Handle to the window that will own the tool tip control. See remarks. |
$iStyle | [optional] ToolTip style: $TTS_ALWAYSTIP (0x01)- Indicates that the ToolTip control appears when the cursor is on a tool even if the ToolTip control's owner window is inactive. Without this style, the ToolTip appears only when the tool's owner window is active. $TTS_NOPREFIX (0x02) - Prevents the system from stripping the ampersand character from a string. Without this style the system automatically strips ampersand characters. This allows an application to use the same string as both a menu item and as text in a ToolTip control. $TTS_NOANIMATE (0x10) - Disables sliding ToolTip animation. $TTS_NOFADE (0x20) - Disables fading ToolTip animation. $TTS_BALLOON (0x40) - Indicates that the ToolTip control has the appearance of a cartoon "balloon" $TTS_CLOSE (0x80) - Displays a close icon so that the tooltip can be cancelled Default: $_TT_ghTTDefaultStyle = BitOr($TTS_ALWAYSTIP, $TTS_NOPREFIX) |
Success: | The handle to the Tooltip control. |
Failure: | 0. |
@error: | 4 - Tooltip cannot be created in an other process. |
$hWnd is usually set to zero (0), or a handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle.
#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
#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