[Solved] How to apply a style_prefix to imagebuttons?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
Halleck
Newbie
Posts: 3
Joined: Tue Mar 28, 2017 4:59 am
Contact:

[Solved] How to apply a style_prefix to imagebuttons?

#1 Post by Halleck »

Hello, guys!

I need help. I'm trying to set the mouse button style property on group of imagebuttons, but with "<name>_button is button" style and "<name>" style_prefix it's working only on textbuttons. I don't want to set the property on every imagebutton separately, and i'm stuck with it. How to fix it? Does anyone have any ideas?

Тhank you in advance!
Last edited by Halleck on Wed Mar 29, 2017 11:45 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: How to apply a style(through style_prefix) to imagebutto

#2 Post by philat »

This isn't a very helpful OP. What are you trying to do exactly? What have you done that hasn't worked? What does your screen look like currently?

User avatar
Halleck
Newbie
Posts: 3
Joined: Tue Mar 28, 2017 4:59 am
Contact:

Re: How to apply a style(through style_prefix) to imagebutto

#3 Post by Halleck »

Hi, philat, thank you for your time. I give you a standard quick_menu screen for example:

Code: Select all

screen quick_menu():

    zorder 100

    if quick_menu:

        hbox:
            style_prefix "quick"

            xalign 0.5
            yalign 1.0

            textbutton _("Back") action Rollback()
            textbutton _("History") action ShowMenu("history")
            textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
            textbutton _("Auto") action Preference("auto-forward", "toggle")
            #textbutton _("Save") action ShowMenu("save")
            imagebutton auto "save_%s.png" action ShowMenu("save")
            textbutton _("Q.Save") action QuickSave()
            textbutton _("Q.Load") action QuickLoad()
            textbutton _("Prefs") action ShowMenu("preferences")

init python:
    config.overlay_screens.append("quick_menu")

default quick_menu = True

style quick_button is default
style quick_button_text is button_text

style quick_button:
    properties gui.button_properties("quick_button")
    mouse "button"

style quick_button_text:
    properties gui.button_text_properties("quick_button")
In this example style_prefix "quick" doesn't work on imagebutton(only on textbuttons). It's just one imagebutton here, but i want to use multiple imagebuttons in many screens and i'm trying to figure out how to use style_prefix on them.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: How to apply a style(through style_prefix) to imagebutto

#4 Post by philat »

I imagine it does work; it just doesn't use prefix_button. The quickest way to check styles, btw, is to run the game and use the style inspector (mouse on the element you want to check and shift+I). From what I saw, by default imagebuttons take prefix_image_button.

User avatar
Halleck
Newbie
Posts: 3
Joined: Tue Mar 28, 2017 4:59 am
Contact:

Re: How to apply a style(through style_prefix) to imagebutto

#5 Post by Halleck »

Thank you very much, it's just what i need and it works like a charm. I don't find it in documentation, but from now on i will follow your advice and use the style inspector.

Post Reply

Who is online

Users browsing this forum: Google [Bot]