pixelsearch Posted August 13, 2020 Share Posted August 13, 2020 Hi everybody I got an issue with the ToolTip command, let me explain with 4 simple examples : #include <AutoItConstants.au3> ToolTip("This is tooltip 1", 0, 0) Sleep(3000) Example 1 above is correct : tooltip 1 shown in the pic got its upper left corner at 0, 0 ************************************************************************* #include <AutoItConstants.au3> ToolTip("This is tooltip 2", 45, 10, "", $TIP_NOICON, $TIP_CENTER) Sleep(3000) Example 2 above is correct : tooltip 2 shown in the pic is centered at coords 45, 10 ************************************************************************* #include <AutoItConstants.au3> ToolTip("This is tooltip 1", 0, 0) Sleep(3000) ToolTip("") ToolTip("This is tooltip 2", 45, 10, "", $TIP_NOICON, $TIP_CENTER) Sleep(3000) Example "1+2" above is incorrect : tooltip 2 shown in the pic is no more centered at coords 45, 10 as it should be. In fact, its upper left corner is placed at 45, 10 ************************************************************************* #include <AutoItConstants.au3> ToolTip("This is tooltip 2", 45, 10, "", $TIP_NOICON, $TIP_CENTER) Sleep(3000) ToolTip("") ToolTip("This is tooltip 1", 0, 0) Sleep(3000) Example "2+1" above is incorrect : tooltip 1 shown in the pic got no more its upper left corner at 0, 0 as it should be. In fact, its centered at 0, 0 (that's why half of it is missing horizontally & vertically) So it seems that when there are 2 different kind of tooltips in the same script (some centered on coords, others not), then the 1st Tooltip options rule (as in examples "1+2" and "2+1") no matter the options found in the following tooltips. As I would like to use these 2 kind of tooltips in the same script, it would be great if any of you faced this problem and found a solution. Thanks Link to comment Share on other sites More sharing options...
Dan_555 Posted August 13, 2020 Share Posted August 13, 2020 (edited) Looks like the new instance of the tooltip uses/adds some of the settings from the previous instance. I'v played a bit with the scripts and this is the solution: #include <AutoItConstants.au3> ToolTip("This is tooltip 2", 45, 10, "", $TIP_NOICON, $TIP_CENTER) Sleep(3000) ToolTip("",0,0,"",0,$TIP_BALLOON) ToolTip("This is tooltip 1", 1, 2) Sleep(3000) Simply, reset/clear the tooltip as ToolTip("",0,0,"",0,$TIP_BALLOON) Edited August 13, 2020 by Dan_555 pixelsearch and Musashi 2 Some of my script sourcecode Link to comment Share on other sites More sharing options...
pixelsearch Posted August 13, 2020 Author Share Posted August 13, 2020 @Dan_555 : fantastic, now it works like a charm ! Here is how it displays now in my script, because sometimes I need to see what's under the centered tooltip, before cropping. In fact I do many operations using the mouse : * Next image in the list with a single left click on the image * Resizing using mouse wheel => Func WM_MOUSEWHEEL() * Cropping with left click pressed > 0.3s * Undo last crop with right click > 0.3s * Save result with right click * Not counting the whole bunch of keys used as Accelerators to navigate within the list of pics (inspired by ACDSee's keys used while browsing a list of pics) $idDummy_Wheel = GUICtrlCreateDummy() ; variable globale : WM_MOUSEWHEEL() => $idDummy_Wheel $idDummy_Esc = GUICtrlCreateDummy() ; variable globale : HotKeySet => _Wanna_Quit() => $idDummy_Esc Local $idDummy_Enter = GUICtrlCreateDummy(), _ $idDummy_Right = GUICtrlCreateDummy(), $idDummy_Left = GUICtrlCreateDummy(), _ $idDummy_Home = GUICtrlCreateDummy(), $idDummy_End = GUICtrlCreateDummy(), _ $idDummy_Up = GUICtrlCreateDummy(), $idDummy_Down = GUICtrlCreateDummy() Local $aAccelKeys[11][2] = [["{ENTER}", $idDummy_Enter], _ ["{RIGHT}", $idDummy_Right], ["{SPACE}", $idDummy_Right], _ ["{LEFT}", $idDummy_Left], ["{BACKSPACE}", $idDummy_Left], _ ["{HOME}", $idDummy_Home], ["{END}", $idDummy_End], _ ["{UP}", $idDummy_Up], ["{NUMPADADD}", $idDummy_Up], _ ["{DOWN}", $idDummy_Down], ["{NUMPADSUB}", $idDummy_Down]] GUISetAccelerators($aAccelKeys) ... Thanks again Dan Link to comment Share on other sites More sharing options...
Loc Posted August 13, 2020 Share Posted August 13, 2020 (edited) Giúp mình xem hộp thư với @Dan Edited August 13, 2020 by Loc Link to comment Share on other sites More sharing options...
Nine Posted August 13, 2020 Share Posted August 13, 2020 I think this could be a good candidate for Bug Tracker though. mikell and Dan_555 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Dan_555 Posted August 14, 2020 Share Posted August 14, 2020 @Nine, yes, i'm going to open a ticket. @Loc, what was that ? Some of my script sourcecode Link to comment Share on other sites More sharing options...
pixelsearch Posted August 14, 2020 Author Share Posted August 14, 2020 @Dan_555: thanks for the ticket opening. In case it may help, the following test also seems to reset the tooltip options : ToolTip("", Default, Default, Default, Default, -1) ; -1 not documented Link to comment Share on other sites More sharing options...
Loc Posted August 14, 2020 Share Posted August 14, 2020 @Dan Link to comment Share on other sites More sharing options...
pixelsearch Posted September 4, 2020 Author Share Posted September 4, 2020 On 8/13/2020 at 7:34 PM, Dan_555 said: Looks like the new instance of the tooltip uses/adds some of the settings from the previous instance. I got a similar (worse) problem with ToolTip, which makes a script completely freeze. Even an Esc HotKey to end the script doesn't respond. The only way to stop the script is to use the Task manager to kill AutoIt3.exe Our discussion above indicated that the problem happened when several Tooltips didn't get the same parameters. But now I find a "complicated" case where the issue appears with only one tooltip in the script, for example, a tooltip placed in a function which will be called several times during the script : Func Show_Tooltip() ToolTip("text here", @DesktopWidth / 2, (@DesktopHeight - $iY_resized) / 2 + 9, "", 0, 2) ; + 9 (good position), 0 = no icon, 2 = center tip at x,y EndFunc 1st time the function is called : no problem. 2nd time the function is called : the script freezes under certain conditions. To solve the issue in all cases (no more freeze) then the function needs to be called like this : Func Show_Tooltip() ToolTip("", 0, 0, "", 0, $TIP_BALLOON) ; Dan_555's patch as ToolTip("") isn't enough ToolTip("text here", @DesktopWidth / 2, (@DesktopHeight - $iY_resized) / 2 + 9, "", 0, 2) ; + 9 (good position), 0 = no icon, 2 = center tip at x,y EndFunc This tip could be helpful in case your script froze and you don't know why, in case you got a tooltip in it. For those of you who are really interested in this issue, here are some infos about the "complicated" case where it happens to me. It involves all of the following : * a parent window $hGUI_Background created with $WS_EX_COMPOSITED extended style (..., $WS_POPUP, $WS_EX_COMPOSITED). Please note that this parent window covers exactly all desktop (width = @DesktopWidth, height = @DesktopHeight) * a child window $hGUI_Preview created with $WS_CHILD style, parent $hGUI_Background (..., $WS_CHILD, -1, $hGUI_Background) * a control image $idPic inside the child window, coords 0, 0 and control size = same size as the child window * GUICtrlSetResizing($idPic, $GUI_DOCKAUTO) so the control image "resizes and repositions according to new window size", great ! * Mouse wheel calls Func WM_MOUSEWHEEL() to zoom + or - the child window (i.e the image) => WinMove($hGUI_Preview, ...) * a tooltip displayed at the top of the child window, each time the image is resized (issue would occur wherever the tooltip is displayed) * freeze arrives as soon as the zoomed image width reaches @DesktopWidth Interesting : as soon as I remove the extended style $WS_EX_COMPOSITED, then there is no freeze at all, even without Dan_555's patch ! But as I added $WS_EX_COMPOSITED to remove all flickering while zooming (and it really works fine), then I'll never remove $WS_EX_COMPOSITED any more. Here is something else I discovered 5 min ago : if the parent GUI didn't cover the whole desktop, then things would have gone much better. For example let's create the parent GUI with Width = @DesktopWidth and Height = @DesktopHeight - 100 (tested) Now we can display the tooltip in a part of the screen outside the parent GUI and there's no freezing at all... even without Dan_555's patch ! So it seems that there is an issue during the redraw, when the parent window got a $WS_EX_COMPOSITED extended style and a tooltip is already present "covering" the parent window. Gee... it wasn't easy to debug. Thanks to Dan_555 for having found a solution and to Jpm who sent the fix to Jon Musashi 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted September 4, 2020 Author Share Posted September 4, 2020 Demonstrative pics : * Vertical coord of parent window : 50 * Black background of parent window * Left side of pic : tooltip centered at 41 vertical : its bottom black border (1 pixel) is displayed outside of the parent window : no freeze * Right side of pic : tooltip centered at 42 vertical : its bottom black border (1 pixel) overlaps the parent window with 1 pixel : freeze Link to comment Share on other sites More sharing options...
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