Page 1 of 2

Hide tooltip instantly?

Posted: Sat Apr 06, 2024 10:32 am
by Zax
Hello,

I have a little cosmetic bug in my AppLauncher standalone: sometimes, when an "icon" is cliked in order to launch the associated file, the "icon" tooltip is still visible on the screen, even if the icons window is closed and the standalone is no longer at frontmost. Sounds like a screen refresh problem.

All of the "icons" are images and their tootips are the name of their associated files, so I can't put empty into their tooltip because they contain important data.

So, my question is: is there a way to hide instantly the tooltip? I found the command:

Code: Select all

set the tooltipDelay to 0
but I'm not sure it will hide instantly the current visible tootltip. In fact, I don't know how to test this effectively and safely.

Furthermore, as this bug only appears sometimes, it's not easy to fix it.

screen.jpg

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 10:51 am
by richmond62
I have just been playing around and found that if you put this in the script of your object:

Code: Select all

on mouseEnter
   set the toolTipDelay to 0
end mouseEnter
The Tool Tip will NOT show at all.

So the question is in this case: "Why do you have a tool tip if you do not want anyone to see it?"

If you do this:

Code: Select all

on mouseEnter
   set the toolTipDelay to 50
end mouseEnter

on mouseLeave
   set the toolTipDelay to 0
end mouseLeave
Obviously, the Tool Tip vanishes as soon as . . .

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 1:09 pm
by Zax
Thank you richmond62 for your answer.

I want the tooltip to be visible... as long as the standalone is in the foreground. And that it hides when the standalone comes on the background (on suspend).
richmond62 wrote:
Sat Apr 06, 2024 10:51 am

Code: Select all

on mouseEnter
   set the toolTipDelay to 50
end mouseEnter

on mouseLeave
   set the toolTipDelay to 0
end mouseLeave
You don't have to write a mouseLeave handler: it's handled by LC.
The problem is a I don't leave the image rect: when a click is made on the image, the standalone is hidden but he mouse is still within the image rect.

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 1:15 pm
by richmond62
Just change the 'mouseLeave' to 'mouseDown'.

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 2:22 pm
by Zax
richmond62 wrote:
Sat Apr 06, 2024 1:15 pm
Just change the 'mouseLeave' to 'mouseDown'.
OK, I'll try.
The real question is: is the tooltip hidden instantly if the tooltipDelay is set to 0 on the fly?
We'll see.

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 3:38 pm
by richmond62
Live dangerously and give it a whirl. 8)

Just to prove my point, in the mouseEnter statement I have set the tooltipDelay to 500.
-
Screenshot 2024-04-06 at 17.36.29.png

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 5:08 pm
by stam
Zax wrote:
Sat Apr 06, 2024 1:09 pm
I want the tooltip to be visible... as long as the standalone is in the foreground. And that it hides when the standalone comes on the background (on suspend).
A different approach may be to use suspendStack and resumeStack.
If your app becomes the foreground app (resumeStack) you could populate tool tips and when it goes into the background (suspendStack) you could clear the tooltip.

Extending the toolTipDelay means it will take longer to show, but it will still show if the mouse is stationary.
So you may for example want to put the toolTip text into a custom property (for the sake of the code below, lets call it uToolTipText) of each object instead of its tool tip.
On the app coming to the foreground, you could for example:

Code: Select all

on resumeStack
   repeat with x = 1 to the number of controls of the current card
      set the tooltip of control x of the current card to the uToolTipText of control x of the current card
   end repeat
end resumeStack
and when it goes to background:

Code: Select all

on suspendStack
   repeat with x = 1 to the number of controls of the current card
      set the tooltip of control x of the current card to empty
   end repeat
end suspendStack
I've not in any way tested this, but it should work as per your request above...
Unless I misunderstood your question of course ;)

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 6:26 pm
by jacque
Here's another untested idea. Tooltips are removed on mouseleave, so try this:

Code: Select all

on suspendStack
  send "mouseleave" to the mouseControl
end suspendStack 

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 6:49 pm
by richmond62
Totally OT, but . . .

Recently . . .

#1 Richmond suggests fairly goofy, simplistic solution.

#2 Klaus or Stam suggest less goofy solution.

#3 Jacque weighs in.

Fairly well established sequence now . . . 8)

Re: Hide tooltip instantly?

Posted: Sat Apr 06, 2024 11:13 pm
by jacque
I should note that I didn't even test my suggestion so I'm not due for any credit yet.

Re: Hide tooltip instantly?

Posted: Sun Apr 07, 2024 6:58 am
by Zax
richmond62 wrote:
Sat Apr 06, 2024 6:49 pm

#1 Richmond suggests fairly goofy, simplistic solution.

#2 Klaus or Stam suggest less goofy solution.

#3 Jacque weighs in.
You forgot the 4th point (and perhaps the most important):
#4 and the OP was happy. :D



@stam: yes, I had considered this kind of solution but I feared a long execution time knowing that I have 96 controls and access to control properties is rather slow.

I'll try Jacques' solution first.
In any case, thank you for all your answers.

Re: Hide tooltip instantly?

Posted: Sun Apr 07, 2024 3:55 pm
by stam
Actually the most important point is that we’re all learning, and this learning is permanently documented and available to subsequent users.

As to why the same users keep responding - well that’s unfortunate. More should be. I am quite happy to watch from a distance if there are progressively better solutions being posted.
And equally if I think of a solution that’s not been mentioned I’m quite happy to post that and I’m ecstatic if some like Jacque posts a better solution, because it furthers my learning.

I do think modernising the forum to a new forum platform like Discourse and importing all the existing phpBB posts might go a long way to encouraging active participation, but the reality is that the number of active participants is low, hence the apparent “well established pattern”…

Re: Hide tooltip instantly?

Posted: Sun Apr 07, 2024 5:13 pm
by richmond62
the number of active participants is low, hence the apparent “well established pattern”…
Yes, a pity really.

An awful lot of people who could have continued to both profit from and contribute to these forums left when the Open Source version was discontinued.

I continue to use the Open Source version and still profit from these forums a lot (and, I hope, contribute to a certain extent).

I know the bad feeling that was generated when the Open Source version was dropped (I also felt it), but, regardless of that, it must be accepted that LiveCode have left us all with a fantastic legacy in the continued availability of the Open Source versions which, quite obviously, involved a large amount of work by the LC team, and for that there is no obvious reason not to be grateful, and it does seem slightly churlish not to keep dialogue open.

Re: Hide tooltip instantly?

Posted: Sun Apr 07, 2024 6:56 pm
by FourthWorld
stam wrote:
Sun Apr 07, 2024 3:55 pm
I do think modernising the forum to a new forum platform like Discourse and importing all the existing phpBB posts might go a long way to encouraging active participation, but the reality is that the number of active participants is low, hence the apparent “well established pattern”…
Yep. I like Discourse a lot (except the server setup, but I'm picky).

But support forum participation for any product is generally a bottom-of-the-funnel metric.

The bottom of a funnel will always be a subset of the width of the top.

Marketing is key.

And when a product is a platform, promoting third-party offerings (tools, tutorials, consulting) is a critically important component to the marketing strategy, demonstrating a healthy ecosystem.

Re: Hide tooltip instantly?

Posted: Sun Apr 07, 2024 7:04 pm
by FourthWorld
Zax wrote:
Sun Apr 07, 2024 6:58 am
@stam: yes, I had considered this kind of solution but I feared a long execution time knowing that I have 96 controls and access to control properties is rather slow.
You might be surprised. I've done a LOT of performance and stress testing of the engine over my decades of relying on it, and I'd venture that querying properties on a hundred objects would be unlikely to take more than a couple milliseconds, if even that (my hunch is microseconds, but it's been a while since I've tested this use case).

It would likely be unnoticeable, and only become measurable with an impractically high number of test iterations.
I'll try Jacques' solution first.
Please let us know how that works out. Less code is often better code, but if it doesn't work as expected I'm sure a broadcasting query loop would be quite satisfying.