Page 1 of 1

[Solved] Tooltips for Labels

Posted: Thu Oct 11, 2018 6:08 am
by martingerdes
According to https://www.renpy.org/doc/html/screen_a ... l#tooltips, any displayable can have a tooltip.

I would like to implement tooltips for stats in a grid (dse-stats.rpy from viewtopic.php?t=31571), so they should be associated with the labels, since there are no buttons.
However, nothing happens when I mouse over the labels. Probably because a label can not gain focus?

I tried to cheat and use it on a button without an action (I am sure I could style them to look like the labels do now), but without an action a button apparently can't gain focus either...

So is there a way to get a tooltip for something which is not clickable?
I guess my next best course of action would be a to make the labels into buttons with a "do nothing" dummy action. Just seems pretty unclean to me...

Is there a list of displayables which can have a tooltip (=gain focus)?

If there is any other documentation about this which I have not found, a link would be much appreciated!

Re: Tooltips for Labels

Posted: Thu Oct 11, 2018 6:32 am
by xavimat
Not only labels, also mouseareas that have the "hovered" property, do not respond to tooltip.
Bars do respond if they can change some value (like in preferences), They don't if given a fixed value.

Probably doc should say, as you say, "available in all displayables that can gain focus" or "all displayables with hovered property" (but this is not always true).

In your case, you can use a textbutton. That "do nothing dummy action" you talk about actually exists: NullAction(). And it exists exactly for that reason, to make buttons(+textbuttons+hotspots+imagebuttons) "responsive to hover/unhover events, without actually doing anything."
https://www.renpy.org/doc/html/screen_a ... NullAction

In any case, I'll ask Pytom if maybe mouseareas and bars (or maybe all displayables) should be able to trigger tooltips.

Re: Tooltips for Labels

Posted: Thu Oct 11, 2018 3:39 pm
by martingerdes
Thank you for the information.
I know of no displayable "textbox", but a textbutton with NullAction() seems to work fine, and I can style it as needed.

Re: Tooltips for Labels

Posted: Thu Oct 11, 2018 6:37 pm
by xavimat
martingerdes wrote:
Thu Oct 11, 2018 3:39 pm
Thank you for the information.
I know of no displayable "textbox", but a textbutton with NullAction() seems to work fine, and I can style it as needed.
Oh, sorry, my bad. I meant "textbutton". :oops:
I've corrected my previous post.