Image as Tooltip?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Image as Tooltip?
Hi all,
When I hover my house over an object (I am guessing the object would have a 'mouseWithin' handler), I would like for a small image to appear...sort of like a tooltip. There are approximately 20 different objects on one card each needing a separate image 'tooltip'.
Suggestions/code examples on how to achieve this?
Thank you,
Jon
When I hover my house over an object (I am guessing the object would have a 'mouseWithin' handler), I would like for a small image to appear...sort of like a tooltip. There are approximately 20 different objects on one card each needing a separate image 'tooltip'.
Suggestions/code examples on how to achieve this?
Thank you,
Jon
-
- Posts: 720
- Joined: Thu Sep 11, 2014 1:49 pm
- Location: The Netherlands
Re: Image as Tooltip?
Maybe you can create a small transparent substack with a changeable image on it and let it show and hover as soon as you mouse is within an object?
Good luck,
Paul
Good luck,
Paul
Re: Image as Tooltip?
Hi Paul,
That's exactly what I did. I have a sub stack with multiple cards. Each card contains an image. Back on the main stack, each object contains mouseEnter and mouseLeave handlers with the mouseEnter handler pointing to a particular card of the sub stack.
Thanks so much,
Jon
That's exactly what I did. I have a sub stack with multiple cards. Each card contains an image. Back on the main stack, each object contains mouseEnter and mouseLeave handlers with the mouseEnter handler pointing to a particular card of the sub stack.
Thanks so much,
Jon
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Image as Tooltip?
Hi Jon,
You may use a group with an image or just one image which is visible on mouseenter at the loc of your object or where you want.
You may change image filename or text according to your object
Best regards
Jean-Marc
You may use a group with an image or just one image which is visible on mouseenter at the loc of your object or where you want.
You may change image filename or text according to your object
Best regards
Jean-Marc
https://alternatic.ch
-
- Posts: 7
- Joined: Mon Jul 02, 2018 4:17 am
Re: Image as Tooltip?
You might want to try using an "on mouseMove" at the card level.
Gets a bit more complex if you have grouped objects, but at least every control will not need a mouseEnter, mouseLeave command.
Code: Select all
on mouseMove
local tObj
put the short name the mouseControl into tObj
if exists(img tObj of stack "iconStack") then
[show the stack with the correct image]
end if
end mouseMove
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Image as Tooltip?
All good suggestions. Try this, Make a few buttons and import an image. Set the rect of the image to 10x10 and lock its loc. In the card script:
You can create a schema where the name (or number or whatever property you want) of the target is used instead of the explicit reference above, and show the image of choice, hiding all the others.
Craig Newman
Code: Select all
on mouseMove x,y
if the mouseloc is within the rect of btn 1 then show img 1 at (x + 20) & "," & y
end mouseMove
Craig Newman
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Image as Tooltip?
Hi All,
Here is a simple stack to compare mouseenter/mousemove for this case. 1. by MouseEnter script behavior and mouseenter in cd script
2. by Mousemove script behavior and mouseenter in cd script
Both need a grc "TrapMouseenter" which send mouseenter catched by mouseenter cd script to hide the image.
The "image tooltip" get the text of an hidden image (one for each btn).
You may set the behavior of btn with radio buttons.
Best
Jean-Marc
Here is a simple stack to compare mouseenter/mousemove for this case. 1. by MouseEnter script behavior and mouseenter in cd script
2. by Mousemove script behavior and mouseenter in cd script
Both need a grc "TrapMouseenter" which send mouseenter catched by mouseenter cd script to hide the image.
The "image tooltip" get the text of an hidden image (one for each btn).
You may set the behavior of btn with radio buttons.
Best
Jean-Marc
https://alternatic.ch
Re: Image as Tooltip?
Hi all,
A mouseEnter and mouseLeave hander for each object did the trick!
Thank you to everyone who responded!
Jon
A mouseEnter and mouseLeave hander for each object did the trick!
Thank you to everyone who responded!
Jon