Page 1 of 1
Tooltip bug
Posted: Sun Sep 23, 2018 12:33 am
by pderocco
If two adjacent and touching objects have the same tooltip, moving the mouse from one onto the other doesn't redraw the tooltip over the other object.
In my case, I have a whole column of buttons with no gaps between them, and if they have the same tooltip, I can wave the mouse over them and the tooltip remains at the first one I moused over. If they have different tooltips, then they follow the mouse just as one would expect.
Until this is fixed, does anyone know if there's something I can put into the mouseEnter handler that would provoke the tooltip to be redrawn?
Re: Tooltip bug
Posted: Sun Sep 23, 2018 8:56 am
by AndyP
You could try various times in the toolTipDelay
e.g.
in the card script
set the toolTipDelay of the target to 200
dictionary entry
http://2108.co.uk/LCDict/api.html?search=tooltipdelay
or
in each button
on mouseLeave
hide the tooltip of me
end mouseLeave
in the card script
on mouseLeave
hide the tooltip of the target
end mouseLeave
edit you may have to use
set the visible of the target to true / false instead of show / hide
Re: Tooltip bug
Posted: Sun Sep 23, 2018 5:01 pm
by jacque
I've done this in the past, see if it still works:
Code: Select all
on mouseEnter
set the tooltip of me to empty
set the tooltip of me to "whatever"
end mouseEnter
Re: Tooltip bug
Posted: Mon Sep 24, 2018 12:55 am
by pderocco
Andy, hiding the target when the mouse exits isn't going to work. I don't want the control to disappear. The "toolTip" is just a text property, not an object in its own right. There presumably is a graphical object somewhere, but LC doesn't seem to give you explicit access to it.
Jacque, I would think your idea would work, but it doesn't. I copied the tooltip to a variable, set it to empty, then set it back to the variable. No joy.
Re: Tooltip bug
Posted: Mon Sep 24, 2018 6:56 am
by SparkOut
I think Andy wasn't trying to hide the target, but hide the tooltip, which (like my following code) he hadn't tested yet. Perhaps a combination?
Code: Select all
on mouseEnter
set the tooltip of me to "Now you see me"
end mouseEnter
on mouseLeave
set the tooltip of me to empty
end mouseLeave
"of me" or the target depending on use of behavior or card script. (Sent on my phone)
Re: Tooltip bug
Posted: Mon Sep 24, 2018 7:24 am
by pderocco
SparkOut wrote: ↑Mon Sep 24, 2018 6:56 am
I think Andy wasn't trying to hide the target, but hide the tooltip, which (like my following code) he hadn't tested yet. Perhaps a combination?
Code: Select all
on mouseEnter
set the tooltip of me to "Now you see me"
end mouseEnter
on mouseLeave
set the tooltip of me to empty
end mouseLeave
"of me" or the target depending on use of behavior or card script. (Sent on my phone)
Yes, but as I said, "the toolTip of the target" isn't an object that can be hidden and shown, it's just a text string.
The reason I'm not setting the tooltip text on entry and then clearing it on exit is that the tooltip takes some computation to generate. The only way I could do that would be to store the tooltip text in another property, so that I wouldn't have to generate it every time the cursor flies by. Perhaps I'll give that a try, but it's getting a little ugly.
Re: Tooltip bug
Posted: Mon Sep 24, 2018 5:00 pm
by SparkOut
Yes it's as noted, the way to hide the tooltip is to set the tooltip property to empty.
It's ugly but I don't see a way round (other than to separate the targets a little).
Re: Tooltip bug
Posted: Mon Sep 24, 2018 6:01 pm
by jacque
That was going to be my next suggestion. Save the tooltip in a custom property of the control and then set the tooltip to empty on mouseLeave and reset it on mouseEnter.
If the user moves the mouse quickly you don't always get both messages, especially if the controls abut each other without space between. If that's happening you may need to do a loop through all the controls and set them all to empty before setting one of them again.
It isn't as messy as it sounds and is pretty fast.