Using the GUIToolTip UDF
-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By endtro
I have a weird problem with a ToolTip function.
It seems that I can't reliably remove a tooltip from the screen if I originally created it by setting a tooltip text via variable, not a straight up string.
Here's a simple script that I used for testing:
After I remade the script into this, it started working just fine (stopped working after I fixed the array comparison):
Basic idea of the script:
You press F1 and a tooltip with some useful info shows up by the mouse cursor. It follows the cursor around until you press F1 again, then it copies the info to the clipboard and hides the tooltip.
It almost seems like if I created a tooltip using a variable to set the text, then ToolTip("") most of the times just repeats the previous use of ToolTip function. If you try to add Sleep(1000) before ToolTip("") in the first draft of the script, you'll see what i mean (if it works the same for everyone, that is).
Is this a bug or am I doing something wrong?
-
By ohaya
Hi,
I am still really new with AutoIT. We are using it to automate logging into web sites and I have encountered problems with focus. The target web page is configured to put the cursor into the first text field (username) when the page is loaded, and when I run the AutoIT script, which does the log in seems like it is just not starting where I expect it to be.
I have been kind of using ToolTip() to kind of help with debugging, but now I am wondering if the calls to ToolTip() are causing the focus to be messed up.
For example, at least visually, when the ToolTip() is called, I can see the cursor disappear from the web page text field and they when I do anything that is supposed to send keystrokes, they are going off somwhere else ("never-neverland").
But when I remove some of the ToolTip() calls, it works correctly.
So the questions I have are:
1) Do the ToolTip() calls interfere with/change where the focus on the target page are?
2) In general, what are the "rules" for where ToolTip can be used "safely" (== doesn't interfere with focus)?
Thanks,
Jim
-
By astrionn
So I had this Idea of creating a tooltip which shows me my ping.
That itself was made quickly and I thought too add a couple features.
I want the tooltip background to be a different color depending on the ping. (good ping is green, medium ping is yellow,...)
So how do I color in a tooltip? google brought me to this:
where in the comments I found this:
$s = "LOW" ToolTip($s, 0, 0, "Battery Information");, $icon) $H_TOOLTIP1 = WinGetHandle($s) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $H_TOOLTIP1, "wstr", "", "wstr", "") DllCall("user32.dll", "int", "SendMessage", "hwnd", $H_TOOLTIP1, "int", 1043, "int", 2552550, "int", 0) Sleep(1000) Which I then used in my code with different color codes... Trial and Error brought me these that I wanted to use:
The Problem is if I loop through my code it only sets the color for the 1st loop and then sticks to it.
The real problem is tho that I don't exactly understand the dllcalls... And I guess that's why it isn't working
So if someone would be so awesome to explain to me how they work, or at least can give me a list of these parameters then I would really appreciate that and learn something new
Obviously a solution to my problem is awesome aswell ^^
I run this under Windows 8.1
There is my code in a paste.
https://pastebin.com/q525f7mS
-
By Trolleule
Hi,
i want to display a tooltip when i hover over the listview group. It sounds not difficult but i couldn't find a solution and i searched for autoit as well as for c# :/
So i came up with a not so pretty solution:
#include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <GuiToolTip.au3> #include <WinAPI.au3> Global $idListview, $hWndListView Global $hToolTip = _GUIToolTip_Create(0, BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON)); balloon style tooltip Global Const $LVN_GROUPINFO = ($LVN_FIRST - 88) Global Const $tagNMLVGROUP = $tagNMHDR & ";int iGroupId;uint iNewState;uint iOldState" ; $LVGS_flags $LVGS_flags Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tInfo, $tNMHDR = DllStructCreate($tagNMHDR, $lParam), $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $iIDFrom = DllStructGetData($tNMHDR, "IDFrom"), $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode ; Case $of?????? ; A Group was clicked <---- I need help with this Case $LVN_GROUPINFO ConsoleWrite("hier" & @CRLF) $tInfo = DllStructCreate($tagNMLVGROUP, $lParam) _DebugPrint("$LVN_GROUPINFO" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->GroupId:" & @TAB & DllStructGetData($tInfo, "iGroupId") & @CRLF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "iNewState") & @CRLF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "iOldState")) Case $LVN_COLUMNCLICK ; A column was clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) _DebugPrint("$LVN_COLUMNCLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @CRLF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) ; No return value Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint If Not StringInStr($CmdLineRaw, "/ErrorStdOut") Then Exit MsgBox($MB_TOPMOST, @ScriptName, 'please run from the editor, thanks', 10) Example() Func Example() Local $aInfo, $hImage, $idListview $ghui = GUICreate("ListView Group COLLAPSIBLE", 400, 300) $idListview = GUICtrlCreateListView("", 30, 20, 354, 218);, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_REPORT, $WS_CLIPSIBLINGS)) $hWndListView = GUICtrlGetHandle($idListview) ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($idListview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($idListview, "Column 1", 100) _GUICtrlListView_AddColumn($idListview, "Column 2", 100) _GUICtrlListView_AddColumn($idListview, "Column 3", 100) ; Add items _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2) _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1) _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2) ; Build groups _GUICtrlListView_EnableGroupView($idListview) _GUICtrlListView_InsertGroup($idListview, -1, 1, "Group 1", 1) ;~ _GUICtrlListView_SetGroupInfo($idListview, 1, "Group 1", 0, $LVGS_COLLAPSIBLE + $LVGS_COLLAPSED) ; <--- _GUICtrlListView_InsertGroup($idListview, -1, 2, "Group 2") ;~ _GUICtrlListView_SetGroupInfo($idListview, 2, "Group 2", 0, $LVGS_COLLAPSIBLE + $LVGS_COLLAPSED) ; <--- _GUICtrlListView_SetItemGroupID($idListview, 0, 1) _GUICtrlListView_SetItemGroupID($idListview, 1, 2) _GUICtrlListView_SetItemGroupID($idListview, 2, 2) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Local $apos = _GUICtrlListView_GetGroupRect($idListview, 2, $LVGGR_LABEL) Local $test = GUICtrlCreateLabel("a", 2, 2, 10, 17) Local $val = _WinAPI_GetWindowLong(GUICtrlGetHandle($test), $GWL_STYLE) Local $valex = _WinAPI_GetWindowLong(GUICtrlGetHandle($test), $GWL_EXSTYLE) Local $aha = _WinAPI_CreateWindowEx($valex+$WS_EX_LAYERED, "static", "blabla", $val, $apos[0], $apos[1], 50, 20, $hWndListView) _GUIToolTip_AddTool($hToolTip, $hWndListView, "This is a ToolTip3", $aha) GUISetState(@SW_SHOW) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Short description: I only created a label with CreateWindowEx which i can append to the listview control and layered it with the $WS_EX_Layered flag so it looks like it's transparent. Then i only added a tooltip tool to that created label.
Hover over the Group 2 text and the Tooltip will be displayed. My question is: does someone know another perhaps much prettier solution?
Thanks in advance
-
By Sucre
I turned to Autoit from AHK just because it support WinForm Application so well. The problem often haunts me that all the application in my job is WinForm. And it indeed help my work so much. Great thanks in advance.
However, I can't get the ToolTip text in the application of my company. Specifically,now I want to get the information about some data, however the information is all displayed in the tooltip on the scatter diagram which is made of those data.
Is there any advice ? Relative topics I have searched can't get any information about the winform tooltip...
-
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now