how to make Button respond to its image child?
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.
-
- Newbie
- Posts: 19
- Joined: Sun Jan 07, 2018 6:23 pm
- Contact:
how to make Button respond to its image child?
I have a Button (the screen language Button which takes multiple children), with a Text and an Image (using "add") inside it. If I hover over the text, the Button's "hovered" action is run, and if I click on the text, the "action" is run. But if I hover over the image or click on the image, it's completely unresponsive. How do I get the button to respond to either of the elements inside it? Isn't that what it's for in the first place?
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: how to make Button respond to its image child?
Code: Select all
button:
focus_mask Image("a.png") # non transparent pixels = sensitive
Code: Select all
textbutton "The Text":
focus_mask Image("a.png") # non transparent pixels = sensitive
background ... an image or (often better to auto scale) Frame
hover_background ... ditto for hover
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
-
- Newbie
- Posts: 19
- Joined: Sun Jan 07, 2018 6:23 pm
- Contact:
Re: how to make Button respond to its image child?
Using focus_mask as my image means the only sensitive part of the button is the image. Making a custom focus_mask image with a box where the text would be is not possible, since the text can be of arbitrary length. Setting the focus_mask to True or None also does not seem to work (the image portion is still not sensitive), despite what https://www.renpy.org/doc/html/style_properties.html says.
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: how to make Button respond to its image child?
It works fine if using textbuttons and scalable Frames with alpha images for focus_mask and all backgrounds. Never tried it through using button: so cannot really help further.
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: Google [Bot]