Sign in to follow this  
Followers 0
mr.underperson

Tooltip Bugs

12 posts in this topic

I have a progress ToolTip. The text changes often. By default it is hard-left.

but I need to also show it centered, as per user preference. however, when trying to

calculate this I stumble upon what looks like a bug.

this one shows exactly in the top-left corner, as expected...

ToolTip(" some text which may or may not be centered depending on user preference ", 0, 0)
Sleep(3000)
exit

but when I try to center it, bad things happen.

this one is partly off-screen by some undefined amount

even though there is no icon, and no title (they are set to "skip")

(we need to specify *something* for these parameters so we can get to optional parameter 3, "center")

ToolTip(" some text which may or may not be centered depending on user preference ", @DesktopWidth / 2, 0, "", -1, 2 )
Sleep(3000)
exit

I can only see the bottom of the text now. That looks like a bug.

While I'm here...

Bug no. 2. or perhaps the documentation is missing something in the remarks.

I'm specifying an "info" icon now. but it won't work..

ToolTip(" some text which may or may not be centered depending on user preference ", @DesktopWidth / 2, 0, "", 1, 2 )
Sleep(3000)
exit

Unless title AND balloon tip are specified, icons are not shown, not on my system.

ToolTip(" some text which may or may not be centered depending on user preference ", @DesktopWidth / 2, 0, "hey!", 1, 3)
Sleep(3000)
exit

But I don't want balloon tips, nor icons; I just want a regular ToolTip, but if it leaps off-screen when centered, even though the other switches are set to be skipped, how can one reliably calculate the y-position?

And what of non-XP boxes? Hacking in +8, or something to compensate for this whacky behaviour, is just asking for trouble.

Is this a bug? I'm using the latest (I think) beta (3.1.1.123)

Can others confirm on their systems?

-mu

Share this post


Link to post
Share on other sites



but when I try to center it, bad things happen.

this one is partly off-screen by some undefined amount

even though there is no icon, and no title (they are set to "skip")

(we need to specify *something* for these parameters so we can get to optional parameter 3, "center")

ToolTip(" some text which may or may not be centered depending on user preference ", @DesktopWidth / 2, 0, "", -1, 2 )
Sleep(3000)
exit
It appears that when using a title (even a blank one).. it effects its top position (Does seem like a bug)

So for now... I would suggest keep doing what you are doing and offset it.

ToolTip(" some text which may or may not be centered depending on user preference ", (@DesktopWidth / 2), 5, "", -1, 2)

While I'm here...

Bug no. 2. or perhaps the documentation is missing something in the remarks.

I'm specifying an "info" icon now. but it won't work..

ToolTip(" some text which may or may not be centered depending on user preference ", @DesktopWidth / 2, 0, "", 1, 2 )
Sleep(3000)
exit

Unless title AND balloon tip are specified, icons are not shown, not on my system.

ToolTip(" some text which may or may not be centered depending on user preference ", @DesktopWidth / 2, 0, "hey!", 1, 3)
Sleep(3000)
exit
As far as the second one.. it seems the Icon will only display on the title line. So, try this to see the actual icon in a normal tooltip (without balloon):

ToolTip("some text which may or may not be centered depending on user preference ", (@DesktopWidth / 2), 20, "hey", 1, 2)
Sleep(3000)

This might actually be an inherent property of the tooltip.. I'm not sure. The first problem you mentioned however, did seem to be a bug.


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

the first bug..

is not a bug... it is centering the width and the "height" thats why it shows off-screen at the top

the second bug

appears to be a bug to me also, a title seems to be required to get the icon to show. the stated "" from help does not work correctly

...........

to fix your problem... maybe

$users_pref = " some text which may or may not be centered depending on user preference "
$length = StringLen($users_pref) *2.5
$position = (@DesktopWidth/2)-($length)
ToolTip($users_pref,$position, 0)
Sleep(3000)

MsgBox(0,$position, $length & @CRLF & @DesktopWidth)

i do not know why i needed the "*2.5" to get center either

(it could be the small size of the text)

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

It appears that when using a title (even a blank one).. it effects its top position

it is the last option "2" that created the problem not the title

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

it is the last option "2" that created the problem not the title

8)

I agree. I don't know why this centering parameter is doing this but anyway I will add a small offset to avoid this "Windows BUG ...".

Perhaps other Dev will find out the right solution if any. :)

Share this post


Link to post
Share on other sites

ha! that's is a good example

ToolTip("some text which may or may not be centered depending on user preference ", (@DesktopWidth / 2), 20, "", 1, 2)
Sleep(3000)

If I'd moved it down I would have seen the balloon-less title.

The first one certainly looks and acts like a bug, but reading that page of the manual, it states "Center the tip at the x,y coordinates instead of using them for the upper left corner.", and with a gasp of horror I realize that "Center of the tip", might actually mean in the dead centre of the tip, horizontally AND vertically, which seems crazy, as opposed to half-way along its width, which is what we usually mean when we refer to "centering" text.

So, we would need to calculate the height of the Tooltip, and then half that. One line is 16 pixels, and so that's +8. Two lines looks like 30 pixels, so it seems to add 12 pixels per line. If there was a title or an icon, those values would need to be added, also. What a palaver!

Surely it *should* centering in the traditional sense?

-mu

[edit - oh! other posts! I had this tab hanging around for a while!]

Share this post


Link to post
Share on other sites

Bug no. 2. or perhaps the documentation is missing something in the remarks.

I'm specifying an "info" icon now. but it won't work..

It is documented:

[optional] Pre-defined icon to show next to the title:

Do we really have to document that further? It says it's shown next to the title, surely people can interpret that as meaning a title has to be present?

As for the other problem, this is a documentation problem. I'm pretty certain that what you are trying to do is not what the center flag is for, however, it's been so long since I wrote the code I don't recall what the flag is for. I think the flag is useful for balloon tips and isn't really relevant for normal tooltips. I'm thinking the flag will alter the stem on the balloon tip to be at the center of the balloon tip at the coordinates specified as opposed to having the stem on the left or right. However, I need to look at the code to confirm exactly how it is being used and then I will correct the documentation accordingly.

Share this post


Link to post
Share on other sites

surely people can interpret that as meaning a title has to be present?

Well, so far in this thread, apart from you, no one has; so clearly the answer is a resounding "NO!"

As for the centering, yes, I'm looking to center in the traditional sense of the word, that is, half-way along the horizontal plane, there's no reason, that I can see, to use the "dead-centre" as the point of reference.

Currently, yes, the stem location is "centered", and also the Tip itself, of course, along BOTH axes. The center flag *could* be useful for regular balloon tips, IF it recognised when no title and no icon is present, and simply centered along the x-axis, without any vertical shift.

Thanks for caring.

-mu

Share this post


Link to post
Share on other sites

Well, so far in this thread, apart from you, no one has; so clearly the answer is a resounding "NO!"

I think several people should learn to read closer, then. Never-the-less, I will make the documentation more verbose.

As for the centering, yes, I'm looking to center in the traditional sense of the word, that is, half-way along the horizontal plane, there's no reason, that I can see, to use the "dead-centre" as the point of reference.

Currently, yes, the stem location is "centered", and also the Tip itself, of course, along BOTH axes. The center flag *could* be useful for regular balloon tips, IF it recognised when no title and no icon is present, and simply centered along the x-axis, without any vertical shift.

Thanks for caring.

-mu

You're making a major assumption here and that assumption is wrong. I'm not doing anything special with the centering flag except setting a style on the Tooltip. Everything else is then up to Windows. Speculation about how or why it works how it works is irrelevant because it's outside of my control how it works. If I do anything, it will be to either clear up the documentation on just what the center flag does or to remove the flag entirely since it doesn't have "common" behavior. The "problem" you have won't be fixed in either case.

Share this post


Link to post
Share on other sites

I don't understand what you mean about my assumption, though I did assume that that this was an AutoIt thing. If it's a Windows thing, that's cool, I understand.

-mu

Share this post


Link to post
Share on other sites

I don't understand what you mean about my assumption, though I did assume that that this was an AutoIt thing. If it's a Windows thing, that's cool, I understand.

-mu

Your assumption, as you state, is that this is something AutoIt is doing which I can fix. That is not the case. All I do is set the flag on the Tooltip control and Windows takes care of the rest. All AutoIt does is detect if the user passed the center flag and if it was, it sets a style on the Tooltip. I think it's one line of code that does that. Everything else is all Windows.

Share this post


Link to post
Share on other sites

I always meant to come back to say, this is just a documentation problem, and whatever you do, please don't remove the flags! It's still the most reliable way to get a tooltip dead centre...

DoTip("I am exactly centered, at the bottom of the screen", 1, 1)

while 1
Sleep (1000)
wend

func DoTip($string, $bottom=false, $center=false)
    $x = 0
    $top = 0
    $op = -1
    if $bottom then $top = @DesktopHeight - 16
    if $center then 
        $x = (@DesktopWidth / 2)
        $top += 8
        $op = 2
    endif
    ToolTip(" " & $string & " ", $x, $top, "", -1, $op)
endfunc

-mu

Share this post


Link to post
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
Sign in to follow this  
Followers 0