Page 1 of 1
Image as Tooltip?
Posted: Fri Jul 06, 2018 6:15 pm
by cmhjon
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

Re: Image as Tooltip?
Posted: Fri Jul 06, 2018 7:44 pm
by mrcoollion
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
Re: Image as Tooltip?
Posted: Fri Jul 06, 2018 7:51 pm
by cmhjon
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
Re: Image as Tooltip?
Posted: Fri Jul 06, 2018 7:57 pm
by jmburnod
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
Re: Image as Tooltip?
Posted: Fri Jul 06, 2018 11:19 pm
by trinitylogics
You might want to try using an "on mouseMove" at the card level.
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
Gets a bit more complex if you have grouped objects, but at least every control will not need a mouseEnter, mouseLeave command.
Re: Image as Tooltip?
Posted: Sat Jul 07, 2018 4:03 am
by dunbarx
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:
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
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
Re: Image as Tooltip?
Posted: Mon Jul 09, 2018 7:42 pm
by jmburnod
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
Re: Image as Tooltip?
Posted: Thu Sep 06, 2018 2:06 pm
by cmhjon
Hi all,
A mouseEnter and mouseLeave hander for each object did the trick!
Thank you to everyone who responded!
Jon
