Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Horizontal Scrollbar with Columns #151

Closed
jgarethw opened this issue Jun 10, 2020 · 2 comments
Closed

No Horizontal Scrollbar with Columns #151

jgarethw opened this issue Jun 10, 2020 · 2 comments
Labels

Comments

@jgarethw
Copy link

Hi there,
I've run into an issue with using Columns, I can't get the horizontal scrollbar to work with it.
The demo C++ code in imgui shows this:

        ImGui::SetNextWindowContentSize(ImVec2(1500.0f, 0.0f));
        ImVec2 child_size = ImVec2(0, ImGui::GetFontSize() * 20.0f);
        ImGui::BeginChild("##ScrollingRegion", child_size, false, ImGuiWindowFlags_HorizontalScrollbar);
        ImGui::Columns(10);
        int ITEMS_COUNT = 2000;
        ImGuiListClipper clipper(ITEMS_COUNT);  // Also demonstrate using the clipper for large list
        while (clipper.Step())
        {
            for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
                for (int j = 0; j < 10; j++)
                {
                    ImGui::Text("Line %d Column %d...", i, j);
                    ImGui::NextColumn();
                }
        }
        ImGui::Columns(1);
        ImGui::EndChild();

I don't think the SetNextWindowContentSize is implemented in pyimgui so I tried this code:

	imgui.set_next_window_size(1500, 0)
        child_flags = imgui.WINDOW_HORIZONTAL_SCROLLING_BAR | imgui.WINDOW_NO_SAVED_SETTINGS
        imgui.begin_child("child_region", 500, 500, border=False, flags=child_flags)
        imgui.columns(10)
        imgui.set_column_width(0, 100)
        imgui.set_column_width(1, 100)
        imgui.set_column_width(2, 100)
        imgui.set_column_width(3, 100)
        imgui.set_column_width(4, 100)
        imgui.set_column_width(5, 100)
        imgui.set_column_width(6, 100)
        imgui.set_column_width(7, 100)
        imgui.set_column_width(8, 100)
        imgui.set_column_width(9, 100)

        for i in range(100):
            for j in range(10):
                imgui.text("Line " + str(i) + " Column " + str(j) + "...")
                imgui.next_column()
            imgui.separator()

        imgui.columns(1)
        imgui.end_child()

which results in a grid with vertical scrollbar but no horizontal scrollbar even though the columns extend off the child region:
columns

Is there a way to make this work in the current version of pyimgui? many thanks in advance!

@swistakm swistakm added the bug label Jul 17, 2020
@swistakm
Copy link
Member

You're right. SetNextWindowContentSize is missing and that is the function you should use to have horizontal scrollbars in your use case. This was already implemented by @Red-Pheonix in #143 but I did not have enough time to make official release since that time. Anyway, I'm on it and it is a matter of days.

@swistakm swistakm added the release pending Merged but still needs official release label Jul 20, 2020
@swistakm
Copy link
Member

Feature that allows to resolve that issue released in 1.2.0

@swistakm swistakm removed the release pending Merged but still needs official release label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants