Hide tooltip instantly?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Zax
Posts: 475
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Hide tooltip instantly?

Post by Zax » Sat Apr 06, 2024 10:32 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9393
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Hide tooltip instantly?

Post by richmond62 » Sat Apr 06, 2024 10:51 am

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 . . .

Zax
Posts: 475
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Hide tooltip instantly?

Post by Zax » Sat Apr 06, 2024 1:09 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9393
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Hide tooltip instantly?

Post by richmond62 » Sat Apr 06, 2024 1:15 pm

Just change the 'mouseLeave' to 'mouseDown'.

Zax
Posts: 475
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Hide tooltip instantly?

Post by Zax » Sat Apr 06, 2024 2:22 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9393
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Hide tooltip instantly?

Post by richmond62 » Sat Apr 06, 2024 3:38 pm

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
Attachments
Tool Tipper.livecode.zip
Stack.
(8.16 KiB) Downloaded 14 times

stam
Posts: 2688
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Hide tooltip instantly?

Post by stam » Sat Apr 06, 2024 5:08 pm

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 ;)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7240
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Hide tooltip instantly?

Post by jacque » Sat Apr 06, 2024 6:26 pm

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 
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9393
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Hide tooltip instantly?

Post by richmond62 » Sat Apr 06, 2024 6:49 pm

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)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7240
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Hide tooltip instantly?

Post by jacque » Sat Apr 06, 2024 11:13 pm

I should note that I didn't even test my suggestion so I'm not due for any credit yet.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Zax
Posts: 475
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Hide tooltip instantly?

Post by Zax » Sun Apr 07, 2024 6:58 am

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.

stam
Posts: 2688
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Hide tooltip instantly?

Post by stam » Sun Apr 07, 2024 3:55 pm

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”…

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9393
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Hide tooltip instantly?

Post by richmond62 » Sun Apr 07, 2024 5:13 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Hide tooltip instantly?

Post by FourthWorld » Sun Apr 07, 2024 6:56 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Hide tooltip instantly?

Post by FourthWorld » Sun Apr 07, 2024 7:04 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”