How to to delay the appearance of tooltips (so that they appear on mouseover + a delay)
"Well-behaved" tooltips don't pop up the instant the user mouses over the trigger, but only after the user leaves the mouse pointer in place for a specific delay.
Using the Sawicki Indirection Technique (named for its creator, fellow JustinMind user Maciej Sawicki), I have implemented this delay in JustinMind Prototyper.
Create the trigger component. This can be pretty much anything. In my app, it's a FontAwesome "fa-info-circle": .
Create your tooltip however you prefer: I use the "Callout" widget for a "talk bubble" style, or a plain old rectangle or label.
Create two text inputs. I set mine 100% transparent, because they're not going to be used as input, but to trigger events when they receive focus. They may be Editable, or not, but they must not be hidden.
Add an "on Mouse Over" event to the trigger component, consisting of three actions:• Pause: 750 milliseconds
• Set Value of a variable "tt_ready" to "true"
"tt_ready" default value = "false"
• Set Focus on one of the inputs
Add an "on Mouse Leave" event to the trigger component, consisting of two actions:• Set Focus on the other input
• Set Value of a variable "tt_ready" to "false"
Add an "on Focus In" event to the first input, consisting of one action:• [Conditional: When "tt_ready"] Show the tooltip.
Add an "on Focus In" event to the second input, consisting of two actions:• Set Value of a variable "tt_ready" to "false"
(important: if you use an effect to hide the tooltip,
this prevents rollovers from triggering the effect.)
• Show the tooltip.
The variable "tt_ready" prevents the tooltip from appearing when the user merely glides over the component without pausing for 750ms. It is set on Mouse Over, and the timer starts running, but is cleared on Mouse Leave, so when the Focus In event reaches the first input, "tt_ready" is false, and the tooltip does not appear.
It works like a dream.
Thanks again to Maciej Sawicki for the idea of using "on Focus In" events as a kind of "subroutine" for indirectly triggering events.