tooltip latency

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

Re: tooltip latency

Post by richmond62 » Fri May 12, 2023 10:46 am

Faux Tool Tips now positioned properly:
-
TT2.png
-

Code: Select all

on mouseEnter
   set the vis of stack "Tipper" to true
   set the lockScreen to true
   put the top of this stack into TT
   put the left of this stack into LL
   open stack "Tipper"
   set the top of stack "Tipper" to (TT + (item 2 of the loc of me))
   set the left of stack "Tipper" to (LL + (item 1 of the loc of me))
   put the short name of me into fld "ff" of stack "Tipper"
   set the lockScreen to false
   wait 10 seconds
   set the vis of stack "Tipper" to false
end mouseEnter
10 second latency.

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

Re: tooltip latency

Post by richmond62 » Fri May 12, 2023 1:10 pm

Sorry, Happy People; I forgot to upload the stack before lunch. 8)

I would suppose, if one wanted to be fussy, one would want an individual substack for each tooltip.
Attachments
Handrolled.livecode.zip
Stack.
(92.6 KiB) Downloaded 71 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9751
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: tooltip latency

Post by dunbarx » Fri May 12, 2023 3:30 pm

Spinabove.
I have absolutely no clue what you're talking about. I can't seem to find any information on how long a toolTip is shown. Or any talk that suggests it would be wonderful to have some voice in the matter?
Well, that was my point last year. I wish there was a property, "the tooltipVisibleDisplayTime". There isn't, so we must roll our own.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9751
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: tooltip latency

Post by dunbarx » Fri May 12, 2023 4:20 pm

Richmond.

I made what I thought was a much simpler stack, just to play around. That stack is attached. It uses "mouseEnter" handlers resident in each field just the way anyone might.

The top field opens a "newToolTip" field at the usual botRight location. No problem. Four lines.

But the bottom field is a mystery to me. If you enter that field, where the "newToolTip" appears at the mouseLoc upon entering its rect, well, see for yourself. I set the showing time to one second just to see what was going on easily.

I am stumped...

Craig
newToolTip.livecode.zip
(1.12 KiB) Downloaded 66 times

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: tooltip latency

Post by RCozens » Fri May 12, 2023 5:09 pm

jacque wrote:
Wed Jul 27, 2022 5:35 pm
We decided on showing a field on mouseEnter and hiding it on mouseLeave.
Morning All,

I implemented Jacque's approach in the original HyperCard version of my app and have continued to use it in the RunRev and LC versions. All cards include a help field at the bottom of the window that displays step-by-step instructions.

I originally feared this might overwhelm the user; but I find experienced users simply ignore that portion of the window unless they are unfamiliar with the functionality of a particular card. I think this approach works better than having the messages pop up in different screen locations for different buttons.

Rob
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

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

Re: tooltip latency

Post by stam » Fri May 12, 2023 6:54 pm

Hi all, these approaches don't really work as a 'proper' tooltip:

- show on both mouseEnter and when the mouse stands still for a while: mouseEnter alone won't cover this. You can fix a delay but the tooltip should not appear if mouse is still moving

- hide if mouse moves, even if still inside the object (ie mouseLeave doesn't come into it)

- show again if moved within the object and then mouse stands still for a while, i.e. even if mouseEnter isn't fired again

- hide when mouse leaves object - with a simple mouseEnter/Leave approach, if you do a super-quick exit, the tooltip is 'stuck' showing.

I worked around these issues by implementing a method for checking mouseLoc and comparing with a stored mouseLoc at a designated interval - the 'delay' requested above.

For mouseLeave, I had to both check that the mouse was actually out of bounds of the object as it seems to fire continuously (bug?) AND clear this handler from the pendingMessages as it seems mouseLeave gets called a lot, even if mouse hasn't left!

The attached works perfectly. The main text field has the script in it, but easily could be a behaviour to attach to any field. The 'tooltip' has a script in it to format its width (up to a limit set in the script) and it's height in case of longer messages.

The message to show in the tooltip, the delay and a switch to show whether tooltips should be shown are all custom props of the field (uTooltip, uDelay and uShowTooltip respectively).

The main script is:

Code: Select all

local sLastMouseLoc

on mouseEnter
    if the uShowtooltip of me then
        put the mouseLoc into sLastMouseLoc
        send "checkIfMouseMoved" to me in (the uDelay of me) milliseconds
    end if
end mouseEnter

command checkIfMouseMoved
    if the tool is "pointer tool" then exit checkIfMouseMoved
    if the mouseLoc is not within the rect of me then exit checkIfMouseMoved
    
    if the mouseLoc <> sLastMouseLoc then
        hide field "tooltip"
        put the mouseLoc into sLastMouseLoc
        send "checkIfMouseMoved" to me in (the uDelay of me) milliseconds
    else
        dispatch "setMyText" to field "toolTip" with the uTooltip of me
    end if
end checkIfMouseMoved

on mouseLeave
    if the tool is "pointer tool" then exit mouseLeave
    if the mouseLoc is not within the rect of me then
        repeat for each line tLine in the pendingMessages
            if "checkIfMouseMoved" is in item 1 of tLine then cancel item 1 of tLine
        end repeat
        hide field "tooltip"
    end if
end mouseLeave
Hope this helps
S.
Attachments
tooltipsy.livecode.zip
(2.4 KiB) Downloaded 66 times

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

Re: tooltip latency

Post by richmond62 » Sat May 13, 2023 7:32 pm

Here's a tooltip idea using a field:
-
SShot 2023-05-13 at 21.30.04.png
-
As you can see; things go wonky when an object is too near to the edge of a stack.
Attachments
Handrolled 2.livecode.zip
Stack.
(108.04 KiB) Downloaded 60 times

Post Reply

Return to “Talking LiveCode”