Jump to content

Tooltip bug on consecutive use?


Guy_
 Share

Recommended Posts

When I uses Tooltip ( "test", 0, 0 ) it always goes perfectly to the top left corner.

If I use the same method shortly after a Tooltip that was displayed with other x, y coordinates, Tooltip( "test", 0, 0) now shoots to negative values on my screen...

B7bX6qe.png

Adding a Tooltip( "" ) inbetween both calls doesn't help either.

It could be a problem with my EIZO screen drivers though, because I also have a situation with my screen capture utility that shifts the screen downwards a bit first...

The  _GetDesktopArea() code is from this forum.

#include <Array.au3>
#include <WinAPI.au3>

Local $aArray = _GetDesktopArea()
;~ _ArrayDisplay($aArray)

; Get the working visible area of the desktop, this doesn't include the area covered by the taskbar.
Func _GetDesktopArea()
    Local Const $SPI_GETWORKAREA = 48
    Local $tWorkArea = DllStructCreate($tagRECT)
    _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, DllStructGetPtr($tWorkArea))
    Local $aReturn[4] = [DllStructGetData($tWorkArea, 'Left'), DllStructGetData($tWorkArea, 'Top'), _
            DllStructGetData($tWorkArea, 'Right') - DllStructGetData($tWorkArea, 'Left'), DllStructGetData($tWorkArea, 'Bottom') - DllStructGetData($tWorkArea, 'Top')]
    Return $aReturn
EndFunc


Global $tooltip = "tooltip test"

ToolTip( $tooltip, Int($aArray[2]/2), Int($aArray[3]/2), Default, Default, 2 )
Sleep(1700)
ToolTip( $tooltip, 0, 0 )
Sleep(3500)
Edited by Guy_
Link to comment
Share on other sites

Just do this:

Global $tooltip = "tooltip test"

ToolTip( $tooltip, 0, 0)
Sleep(1000)
ToolTip("", 0, 0)
sleep(1000)
ToolTip( "hi", 0, 0)
sleep(1000)
ToolTip("")

I took out the function, as it seemed not needed (hey, I could be wrong and please tell me so :) )

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Moderators

My guess is the OP is trying to center the first tooltip, regardless of the resolution. Hence the _getDesktopArea()

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Indeed, the function is not really important for the demo.

The point is that the first tooltip has different x,y values that seem to screw up the next instance here...

So MikahS, you should put in different x,y coordinates somewhere to demonstrate your solution ;)

It would be good to know if anyone else has this problem?  It could be my screen drivers...

Edited by Guy_
Link to comment
Share on other sites

My apologies.

I will test more. :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Moderators

I am able to replicate the issue on several machines. I have not had a chance to delve in beyond that yet.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I am able to replicate as well.

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

@_Guy: do you get the same bug with this script?

ToolTip("some", 0, 0)
Sleep(1000)
ToolTip("")
ToolTip("other", 25, 73)
Sleep(1000)
ToolTip("")
ToolTip("some", 0, 0)
Sleep(5000)
Link to comment
Share on other sites

Hmm, will this work for you?

#include <Array.au3>
#include <WinAPI.au3>

Local $aArray = _GetDesktopArea()
;~ _ArrayDisplay($aArray)

; Get the working visible area of the desktop, this doesn't include the area covered by the taskbar.
Func _GetDesktopArea()
    Local Const $SPI_GETWORKAREA = 48
    Local $tWorkArea = DllStructCreate($tagRECT)
    _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, DllStructGetPtr($tWorkArea))
    Local $aReturn[4] = [DllStructGetData($tWorkArea, 'Left'), DllStructGetData($tWorkArea, 'Top'), _
            DllStructGetData($tWorkArea, 'Right') - DllStructGetData($tWorkArea, 'Left'), DllStructGetData($tWorkArea, 'Bottom') - DllStructGetData($tWorkArea, 'Top')]
    Return $aReturn
EndFunc



Global $tooltip = "tooltip test"

ToolTip($tooltip,  Int($aArray[2]/2), Int($aArray[3]/2), Default, Default, 2)
sleep(1000)
ToolTip($tooltip, 0, 0, Default, Default, 1)
Sleep(3500)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Yes, the pointer of the bubble points exactly to the corner :)  (but I don't like the bubbles in my scenario)

 

No problem, and I know it looks kinda weird ;)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Turns out the problem still exists.

If you put something like Tooltip("", 0, 0) in front... yes, the 3rd tooltip will display nicely at 0,0 again, but now the 2nd tooltip's x,y is not respected.

I first thought stuff was off because I have a 2nd screen sometimes on and so some _GetDesktopArea values might have picked the wrong size, but no... it really seems a "consecutive tooltip" bug.

Edited by Guy_
Link to comment
Share on other sites

Are you sure that the tooltip is in the wrong place if you use Tooltip("", 0, 0) before it? Are you sure that not using that before the tooltip isn't causing the one in the middle of the screen to be in the wrong place and this is correcting it?

 

EDIT: I just checked this on my computer, dual monitors, Windows 7 x64. When I don't use Tooltip("", 0, 0) before the one that is supposed to display in the middle of the screen, the tooltip is in the wrong place. It displays up and to the left of where it's supposed to be. When I do use Tooltip("", 0, 0) before that tooltip, the middle of the screen tooltip is displaying at the proper coordinates.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Woah, _GetDesktopArea() looks familiar. Blast from the past I see.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Are you sure that the tooltip is in the wrong place if you use Tooltip("", 0, 0) before it? Are you sure that not using that before the tooltip isn't causing the one in the middle of the screen to be in the wrong place and this is correcting it?

 

Your formulation throws me off a little... :)  (not native English)

But yes, I think I'm sure.  I just tested again.

I discovered it by seeing the "supposed to be centering" tooltip appeared more to the right, more in the middle of as if I was using a dual screen setup, so at first I thought I had changed the code to "appear near cursor". But no.

So to recap both failing methods:

1) ToolTip( $txt, Int($desktop_x / 2), Int($desktop_y / 2), Default, Default, 2 ) : SUCCESS

2) ToolTip( $txt, 0,0) : FAILS (slightly negative values)

--

1) Tooltip( "", 0,0)

2) ToolTip( $txt, Int($desktop_x / 2), Int($desktop_y / 2), Default, Default, 2 ) : FAILS (obviously too far to the right)

3) ToolTip( $txt, 0,0) : SUCCESS

Edited by Guy_
Link to comment
Share on other sites

What are you using to determine that the second set of coordinates are wrong? I checked on my computer and it was opposite of this.

1) ToolTip( $txt, Int($desktop_x / 2), Int($desktop_y / 2), Default, Default, 2 ) : Failure - the tool tip is up and to the left of the center of the screen (570 and 926)

2) ToolTip( $txt, 0,0) : FAILS (slightly negative values)

--

1) Tooltip( "", 0,0)
2) ToolTip( $txt, Int($desktop_x / 2), Int($desktop_y / 2), Default, Default, 2 ) : Success - the top left corner of the tooltip is right where it's supposed to be on my computer (580 and 960)

3) ToolTip( $txt, 0,0) : SUCCESS

I used the Au3Info tool and looked on the Mouse tab to see where the pointer was.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

What are you using to determine that the second set of coordinates are wrong?

 

Well, mostly my eyes and some checks.

1) I checked if the $vars are getting the right desktop dimensions: yes

2) I tested with the mouse pointer (clicked or not) in different screen positions, always with the same result

I just measured the position of the tooltip and it always starts at exactly half of the screen  (px 960 of my 1920 px screen)

With the other method, it looks perfectly centered.

Edited by Guy_
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...