Tooltip card / stack / graphical tooltip

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Tooltip card / stack / graphical tooltip

Post by andyh1234 » Mon May 26, 2008 12:14 pm

Does anyone know if it it possible to open a stack / card and have it display like a tooltip.

Id like to give the user some more information about a database entry when they hover over an entry, like a tooltip but the information contains a pie chart so Id need to have a card / stack come up with the chart on it, then when the user moves over a different entry it can change.

I can use the text handlers to figure out what the user is hovering over, but what is the best way to load a card as if it were a tooltip, has anyon e else tried this?

Thanks

Andy

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Location: Kent, UK
Contact:

Post by gyroscope » Mon May 26, 2008 2:51 pm

Hi Andy

One way would be to make a subStack with as many cards as you have pie charts, set the background of the stack to yellow if required, and add all of your pie charts to the cards.

In the preOpenStack handler of this subStack, put

Code: Select all

 set the decorations of me to empty
set the shadow of me to false
 
Then when your hovering place is triggered, in its handler set it to open the appropriate card of the substack, with the script to includethe positioning of the subStack in relation to the database entry.

Hope that sorts it for you...

:)

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Mon May 26, 2008 6:17 pm

Thanks, that works ok so far.

One problem though is when the tooltip stack is shown is grabs focus from the text box, so the user is no longer able to click through the box using the up and down arrows, only the mouse works.

If I use the 'focus on' command to return the focus to the text box, the tooltip disappears behind the window.

Any thoughts on how I can get the tooltip stack to show, but not to take any sort of input or grab the focus at all, im sure it is possible but cant think of it at the moment!!

I know I can set all the focus options to none, but as soon as I return focus to the text box, the tip window vanished behind the current card.


Andy

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Mon May 26, 2008 6:32 pm

Hi Andy,

you can:

1. Still use the trick with setting the "focus" back but then you should
2. Open the "tooltips" as palette ;-)
3. To add a bit of "eyecandy": set "the blendlevel" of the "tooltip" stack to 50 or hwatever before opening


Regards

Klaus

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Location: Kent, UK
Contact:

Post by gyroscope » Mon May 26, 2008 11:48 pm

Hi Andy

I've learnt something from Klaus there as well! i.e setting the "mock tooltip" window as a palette keeps the focus of elements in the one field...

Anyhow, I'm sure you know this but just in case not: to get rid of the palette window bar, import a white image the same size as the palette window and set its Shape in its Inspector to that image.

:)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Tue May 27, 2008 8:21 am

Hi gyroscope,

no need to use a windowshape, seems to be overkill in this case!

Just "set the decorations" of that stack to empty and set its style to "palette".
Noone will tell the difference ;-)


Best

Klaus

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Location: Kent, UK
Contact:

Post by gyroscope » Tue May 27, 2008 12:05 pm

Hi Klaus

I did try empty decorations on a palette yesterday but it wasn't playing nicely, for some reason. Tried it again today, and it works fine.

Thank you for that! :)

Hi Andy

Code: Select all

set the shadow of me to false
Do you know, I would have bet you a tenner that tooltips don't have shadows! Cleaning my glasses now... :wink:

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Tue May 27, 2008 5:06 pm

Brilliant!

Palette stack "Tooltip"

followed by...

Show stack "Tooltip"

works a treat, thanks.

Andy

Post Reply

Return to “Talking LiveCode”