[Klonan] scroll pane without scrollbars

xyzzycgn
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Dec 24, 2024 7:37 pm
Contact:

[Klonan] scroll pane without scrollbars

Post by xyzzycgn »

Is it possible to have a scroll pane without scrollbars which is still scrollable (with mouse wheel)?

I've already tried the *_scroll_policies with "dont-show-but-allow-scrolling", but unfortunatelly scrollbars are still shown and I can't see any difference in behaviour to "auto".

Thx in advance
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5403
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: scroll pane without scrollbars

Post by Klonan »

xyzzycgn wrote: Wed Jan 29, 2025 7:34 am Is it possible to have a scroll pane without scrollbars which is still scrollable (with mouse wheel)?

I've already tried the *_scroll_policies with "dont-show-but-allow-scrolling", but unfortunatelly scrollbars are still shown and I can't see any difference in behaviour to "auto".

Thx in advance
It should work with that policy, can you post your code?
xyzzycgn
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Dec 24, 2024 7:37 pm
Contact:

Re: scroll pane without scrollbars

Post by xyzzycgn »

Hi Klonan,

thx for your quick response.

This is the relevant part of the code, where the scroll pane sp is created:

Code: Select all

function testtab.update(refs, data)
    local container = refs.testtab_tab

    -- ugly - clear all children and create new ones
    container.clear()

    local sp = container.add {
        type = "scroll-pane",
        style = "rldman_small_slot_table_scroll_pane",
        name = "scrollpane"
    }

    local filler = container.add {
        type = "flow",
        direction = "horizontal",
        width = 450,
        height = 76,
        name = "filler-in-container"
    }

    local lfiller = filler.add {
        type = "label",
        width = 450,
        height = 76,
        caption = "xxxxxxxxxxxxxxxxxxx",
        name = "label-in-filler"
    }

    local table = sp.add {
        type = "flow",
        style = "rldman_no_stretch_no_squash_flow",
        direction = "horizontal",
        name = "flow-in-scrollpane"
    }

    testtabData(table, data)
end
The two used styles look like that:

Code: Select all

styles.rldman_small_slot_table_scroll_pane = {
    type = "scroll_pane_style",
    parent = "flib_naked_scroll_pane_no_padding",
    --horizontal_scroll_policy = "never",
    horizontal_scroll_policy = "dont-show-but-allow-scrolling",
    --horizontal_scroll_policy = "auto",
    vertical_scroll_policy = "never",
    width = 44 * 2,
    height = 66,
    padding = 0,
}

styles.rldman_no_stretch_no_squash_flow = {
    type = "horizontal_flow_style",
    horizontally_stretchable = "off",
    vertically_stretchable = "off",
    horizontally_squashable = "on",
    vertically_squashable = "on",
}
The function testtabData() adds 4 sprites to the flow called table inside the scroll pane.

The result look like that:
Image
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5403
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: scroll pane without scrollbars

Post by Klonan »

The policy is not set by the Style, but in the gui element directly (during creation of afterwards):

Code: Select all

    local sp = container.add {
        type = "scroll-pane",
        style = "rldman_small_slot_table_scroll_pane",
        horizontal_scroll_policy = "dont-show-but-allow-scrolling",
        name = "scrollpane"
    }
xyzzycgn
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Dec 24, 2024 7:37 pm
Contact:

Re: scroll pane without scrollbars

Post by xyzzycgn »

Oh yeah, you're right - that is wrong ;)

Unfortunately there is no change in behavior after correcting this (I've checked whether the policy is now set correctly by logging the content of the field)
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5403
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: scroll pane without scrollbars

Post by Klonan »

xyzzycgn wrote: Thu Jan 30, 2025 1:20 pm Oh yeah, you're right - that is wrong ;)

Unfortunately there is no change in behavior after correcting this (I've checked whether the policy is now set correctly by logging the content of the field)
Hmm, can you try setting it after creation?

Code: Select all

    local sp = container.add {
        type = "scroll-pane",
        style = "rldman_small_slot_table_scroll_pane",
        name = "scrollpane"
    }
  sp.horizontal_scroll_policy = "dont-show-but-allow-scrolling"
xyzzycgn
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Dec 24, 2024 7:37 pm
Contact:

Re: scroll pane without scrollbars

Post by xyzzycgn »

Klonan wrote: Thu Jan 30, 2025 1:56 pm Hmm, can you try setting it after creation?

Code: Select all

    local sp = container.add {
        type = "scroll-pane",
        style = "rldman_small_slot_table_scroll_pane",
        name = "scrollpane"
    }
  sp.horizontal_scroll_policy = "dont-show-but-allow-scrolling"
Of course :D

Code now is

Code: Select all

    local sp = container.add {
        type = "scroll-pane",
        style = "rldman_small_slot_table_scroll_pane",
        --horizontal_scroll_policy = "dont-show-but-allow-scrolling",
        --vertical_scroll_policy = "never",
        name = "scrollpane"
    }
    sp.horizontal_scroll_policy = "dont-show-but-allow-scrolling"
    sp.vertical_scroll_policy = "never"
But no change in behavior
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5403
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: scroll pane without scrollbars

Post by Klonan »

Okay I looked a bit deeper, and it seems its only supported for textboxes at the moment,
I will move this to bugs and assign it to me so I don't forget to look into adding support to normal scroll panes
xyzzycgn
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Dec 24, 2024 7:37 pm
Contact:

Re: [Klonan] scroll pane without scrollbars

Post by xyzzycgn »

Thx for your efforts and I am excited about the solution
Post Reply

Return to “Assigned”