How to fix the size of the slider on the History screen? [SOLVED]

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
Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

How to fix the size of the slider on the History screen? [SOLVED]

#1 Post by Maou Zenigame »

On my game's History screen, I'm using this vertical scrollbar
pg_scroller.png
pg_scroller.png (7.13 KiB) Viewed 983 times
along with this slider.
pg_thumb.png
pg_thumb.png (8.13 KiB) Viewed 983 times
Thing is, the slider stretches out at the start of the game where there isn't a lot of text and over time ends up getting squashed to the point where it's barely visible anymore.
scrollbar.png
Is there any way to get the slider to maintain its orginal size regardless of how many lines are stored in the backlog?


For reference, here's the code I'm using:

Code: Select all

screen history():
    tag menu
    add "gui/History/pg_history.png"
    predict False

    side "c r":
        area (100, 100, 650, 400)
        
        viewport id "vp":
            scrollbars "vertical"
            draggable True
            mousewheel True
            arrowkeys True
            yinitial 1.0
            area (230, 70, 1800, 470)
            
            vbox:
                for h in _history_list:
                    if h.who:
                        label h.who:
                            style "history_name"
                            
                            ## Take the color of the who text from the Character, if
                            ## set.
                            if "color" in h.who_args:
                                text_color h.who_args["color"]
                    frame background None bottom_margin 50: # add this line
                        text h.what outlines [ (1, "#000000", 0, 0), (0, "#000000", 2, 2) ]

                if not _history_list:
                    label _("The dialogue history is empty.")

## This determines what tags are allowed to be displayed on the history screen.

define gui.history_allow_tags = set()


style history_window is empty

style history_name is gui_label
style history_name_text is gui_label_text
style history_text is gui_text

style history_text is gui_text

style history_label is gui_label
style history_label_text is gui_label_text

style history_window:
    xfill True
    ysize gui.history_height

style history_name:
    xpos gui.history_name_xpos
    xanchor gui.history_name_xalign
    ypos gui.history_name_ypos
    xsize gui.history_name_width

style history_name_text:
    min_width gui.history_name_width
    text_align gui.history_name_xalign
    font "Kingthings_Petrock.ttf"
    size 40
    color "#2F5F83"


style history_text:
    xpos gui.history_text_xpos
    ypos gui.history_text_ypos
    xanchor gui.history_text_xalign
    xsize gui.history_text_width
    min_width gui.history_text_width
    text_align gui.history_text_xalign
    layout ("subtitle" if gui.history_text_xalign else "tex")

style history_label:
    xfill True

style history_label_text:
    xalign 0.5
Last edited by Maou Zenigame on Wed Jun 06, 2018 3:45 am, edited 1 time in total.

Maou Zenigame
Regular
Posts: 66
Joined: Thu Nov 09, 2017 3:09 am
Contact:

Re: How to fix the size of the slider on the History screen?

#2 Post by Maou Zenigame »

Never mind, I just figured it out on my own.

All I had to do was mess around with the definition of the scrollbar itself.

Code: Select all

style vscrollbar:
    xsize gui.scrollbar_size
    base_bar Frame("gui/History/pg_scroller.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile)
    thumb "gui/History/pg_thumb.png"

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: How to fix the size of the slider on the History screen? [SOLVED]

#3 Post by TellerFarsight »

I actually had the same problem earlier. It's nice because you can actually see the "sliders" for reference on how to do it, and they're right there next to "scrollbar" in the screens code. My issue, which may have been something you dealt with, is that the thumb doesn't center on the scrollbar. Did you figure out how to fix this?
Untitled.png
Untitled.png (2.03 KiB) Viewed 961 times
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to fix the size of the slider on the History screen? [SOLVED]

#4 Post by kivik »

What are the properties on your slider and thumb? Guessing it's an align / pos / padding / margin issue?

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: How to fix the size of the slider on the History screen? [SOLVED]

#5 Post by TellerFarsight »

It must be padding or margins, because I don't really understand how those work and I definitely tried align and pos and offset. I ended up working around it by changing the actual .png file of the scrollbar to have an extra pixel of empty space on the left.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

Post Reply

Who is online

Users browsing this forum: Exabot [Bot], fufuffiero, Sugar_and_rice