[Solved] Tooltips flash for a split second when button tapped on mobile.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
[Solved] Tooltips flash for a split second when button tapped on mobile.
If you press and hold a button on mobile, the tooltip shows correctly. It's quite helpful, but if you tap the button real fast, the tooltip will flash for a split second which is kind of annoying. Anyone know a solution where I can keep the tooltips on mobile, but not have it flash if the button tap only lasts a second or less?
Last edited by henvu50 on Tue Aug 24, 2021 12:25 pm, edited 1 time in total.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
- Contact:
Re: Tooltips flash for a split second when button tapped on mobile.
Tool tips activate on the hover event. If you only tap, you aren't hovering.
One solution I can think of might be to use the legacy tool tip listed in the documentation.
One solution I can think of might be to use the legacy tool tip listed in the documentation.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Re: Tooltips flash for a split second when button tapped on mobile.
When I simulate Android Phone via renpy, a click (simulating a tap) will trigger the tooltip to show for a split second. Are you saying on a real mobile phone it won't do that? I just tested on Android simulator and the tooltip still flashes, but let me try making a fresh & new project to make sure it's not my fault (user error).
Edit: I just made a new project. I used this example tooltip from the ren'py documentation. The tooltip will still flash for a split second in Android Studio and via Ren'py phone emulator.
Code: Select all
screen tooltip_example():
vbox:
textbutton "North":
action Return("n")
tooltip "To meet a polar bear."
$ tooltip = GetTooltip()
if tooltip:
text "[tooltip]"
Edit: Okay time to try legacy tooltip.
Edit: Legacy Tooltip also flashes via this code in a new project.
Code: Select all
screen tooltip_test:
default tt = Tooltip("")
frame:
xpos 500
ypos 100
xfill True
has vbox
textbutton "One.":
action Return(1)
hovered tt.Action("The loneliest number.")
text tt.value size 60
Last edited by henvu50 on Tue Aug 24, 2021 12:21 pm, edited 3 times in total.
Re: Tooltips flash for a split second when button tapped on mobile.
Kind of workaround is to add a tiny pause before showing the tooltip, likehenvu50 wrote: ↑Mon Aug 23, 2021 7:16 pmIf you press and hold a button on mobile, the tooltip shows correctly. It's quite helpful, but if you tap the button real fast, the tooltip will flash for a split second which is kind of annoying. Anyone know a solution where I can keep the tooltips on mobile, but not have it flash if the button tap only lasts a second or less?
Code: Select all
screen tooltip_example():
default flag = False
vbox:
spacing 20
pos (0.5, 0.2) anchor(0.0, 0.0)
textbutton "North":
action NullAction() #Return("n")
tooltip "To meet a polar bear."
textbutton "South":
action NullAction() #Return("s")
tooltip "All the way to the tropics."
textbutton "East":
action NullAction() #Return("e")
tooltip "So we can embrace the dawn."
textbutton "West":
action NullAction() #Return("w")
tooltip "Where to go to see the best sunsets."
$ tooltip = GetTooltip()
if tooltip:
if not flag:
timer 0.1 action SetScreenVariable("flag", True)
else:
text "[tooltip]"
else:
$ flag = False
# The game starts here.
label start:
"..."
call screen tooltip_example
"?!"Re: Tooltips flash for a split second when button tapped on mobile.
Thanks for this. I'm going to try it right now.Alex wrote: ↑Tue Aug 24, 2021 12:09 pmKind of workaround is to add a tiny pause before showing the tooltip, likehenvu50 wrote: ↑Mon Aug 23, 2021 7:16 pmIf you press and hold a button on mobile, the tooltip shows correctly. It's quite helpful, but if you tap the button real fast, the tooltip will flash for a split second which is kind of annoying. Anyone know a solution where I can keep the tooltips on mobile, but not have it flash if the button tap only lasts a second or less?Code: Select all
screen tooltip_example(): default flag = False vbox: spacing 20 pos (0.5, 0.2) anchor(0.0, 0.0) textbutton "North": action NullAction() #Return("n") tooltip "To meet a polar bear." textbutton "South": action NullAction() #Return("s") tooltip "All the way to the tropics." textbutton "East": action NullAction() #Return("e") tooltip "So we can embrace the dawn." textbutton "West": action NullAction() #Return("w") tooltip "Where to go to see the best sunsets." $ tooltip = GetTooltip() if tooltip: if not flag: timer 0.1 action SetScreenVariable("flag", True) else: text "[tooltip]" else: $ flag = False # The game starts here. label start: "..." call screen tooltip_example "?!"
EDIT: IT WORKED. Thank you so much. I set the time to 0.4, and I'll inform the user to press and hold any button they want more information on.
Re: [Solved] Tooltips flash for a split second when button tapped on mobile.
Just an FYI. I can't get Alex's code to work when using transclusion (USE statement).
For example, the tooltip & timer trick doesn't work here for some reason because the screen is being called via use:
It seems in order to get this code to work in the main & game menu's, I have to do this:
A bit sloppy, but it's not a big deal. 
For example, the tooltip & timer trick doesn't work here for some reason because the screen is being called via use:
Code: Select all
screen testA():
text 'hi'
use tooltip_example
screen tooltip_example():
default flag = False
vbox:
spacing 20
pos (0.5, 0.2) anchor(0.0, 0.0)
textbutton "North":
action NullAction() #Return("n")
tooltip "To meet a polar bear."
$ tooltip = GetTooltip()
if tooltip:
if not flag:
timer 0.1 action SetScreenVariable("flag", True)
else:
text "[tooltip]"
else:
$ flag = False
# The game starts here.
label start:
"..."
show screen tooltip_example
"?!"
Code: Select all
screen main_menu():
# ..................
default flag = False
$ tooltip = GetTooltip()
if tooltip:
if not flag:
timer 0.1 action SetScreenVariable("flag", True)
else:
text "[tooltip]"
else:
$ flag = False
screen game_menu():
# ..................
default flag = False
$ tooltip = GetTooltip()
if tooltip:
if not flag:
timer 0.1 action SetScreenVariable("flag", True)
else:
text "[tooltip]"
else:
$ flag = False
Re: [Solved] Tooltips flash for a split second when button tapped on mobile.
Not tested, but you could try to show a tooltip text at some transform, like
Code: Select all
transform tt_transform():
alpha 0.0
0.4
alpha 1.0Code: Select all
if tooltip:
text "[tooltip]" at tt_transformRe: [Solved] Tooltips flash for a split second when button tapped on mobile.
That worked very well. This issue is totally resolved. Thanks again.Alex wrote: ↑Tue Aug 24, 2021 1:59 pmNot tested, but you could try to show a tooltip text at some transform, likeCode: Select all
transform tt_transform(): alpha 0.0 0.4 alpha 1.0Code: Select all
if tooltip: text "[tooltip]" at tt_transform
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
- Contact:
Re: Tooltips flash for a split second when button tapped on mobile.
I misread your original post and thought you were asking why tooltips disappear after a tap.henvu50 wrote: ↑Tue Aug 24, 2021 11:43 amWhen I simulate Android Phone via renpy, a click (simulating a tap) will trigger the tooltip to show for a split second. Are you saying on a real mobile phone it won't do that? I just tested on Android simulator and the tooltip still flashes, but let me try making a fresh & new project to make sure it's not my fault (user error).
Edit: I just made a new project. I used this example tooltip from the ren'py documentation. The tooltip will still flash for a split second in Android Studio and via Ren'py phone emulator.Code: Select all
screen tooltip_example(): vbox: textbutton "North": action Return("n") tooltip "To meet a polar bear." $ tooltip = GetTooltip() if tooltip: text "[tooltip]"
Edit: Okay time to try legacy tooltip.
Edit: Legacy Tooltip also flashes via this code in a new project.I'm surprised no one else brought up this issue. That must mean that tooltip usage is not really a thing on mobile? When you tap and hold, you can clearly see the tooltip, so it does serve a helpful purpose if it didn't flash on tap.Code: Select all
screen tooltip_test: default tt = Tooltip("") frame: xpos 500 ypos 100 xfill True has vbox textbutton "One.": action Return(1) hovered tt.Action("The loneliest number.") text tt.value size 60
Glad to see you've got it forged with some help.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Who is online
Users browsing this forum: Google [Bot], span4ev