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

Horizontal scrollbar clipping problems #519

Closed
Flix01 opened this issue Feb 4, 2016 · 7 comments
Closed

Horizontal scrollbar clipping problems #519

Flix01 opened this issue Feb 4, 2016 · 7 comments

Comments

@Flix01
Copy link

Flix01 commented Feb 4, 2016

Hi.

I've rarely used horizontal scroll bars so far.
However I've tried using a horizontal scroll bar together with a "column layout", and I've discovered that last column text gets clipped like in the image:
columnsandhorscrollbaclipping

I'm not sure if it's my fault or not. Do you have some advice about it ?

@ocornut
Copy link
Owner

ocornut commented Feb 4, 2016

I'll look into it. Columns are still full of issues. Consider setting an explicit content width.

@Flix01
Copy link
Author

Flix01 commented Feb 4, 2016

OK, but it might be something in my code: it's an old piece of code where I explicitly used ImGui::SetColumnOffset(...) (every frame or so)... maybe that did not take ImGui::GetScrollX() into consideration (horizontal scroll bars did not exist when I wrote that code...).

@ocornut ocornut added the bug label Feb 17, 2016
@Eoghanenigma
Copy link

I've just run into this issue myself.
I have a few columns, the left hand columns are small and so i used SetColumnOffset to restrict their width.
The final column contains a longer string so I'd like it to be flexibly sized.

Just as the gif shows above, the columns will track with the scroll bar correctly, but the clipping on the final column shrinks until the last column is completely cutoff.

@sonoro1234
Copy link

Happens for example in Example app Log: Last line is partially covered by horizontal scrollbar

@ocornut
Copy link
Owner

ocornut commented Aug 7, 2017

@sonoro1234 The bug you are referring to is unrelated to this thread, I think it is #665 which I have just fixed.

ocornut added a commit that referenced this issue Aug 20, 2017
… do not register its content to the parent, not affecting the window contents size. (#519, #125, #913)
@ocornut
Copy link
Owner

ocornut commented Aug 20, 2017

This should be fixed now. @Flix01
Not that Columns will FIT within the given space they have and therefore if you want an horizontally scrollable columns set you likely need to set a content width explicitly. See SetNextWindowContentWidth.

if (ImGui::TreeNode("Horizontal Scrolling"))
{
    ImGui::SetNextWindowContentWidth(1500);
    ImGui::BeginChild("##scrollingregion", ImVec2(0, 120), false, ImGuiWindowFlags_HorizontalScrollbar);
    ImGui::Columns(10);
    for (int i = 0; i < 20; i++)
        for (int j = 0; j < 10; j++)
        {
            ImGui::Text("Line %d Column %d...", i, j);
            ImGui::NextColumn();
        }
    ImGui::Columns(1);
    ImGui::EndChild();
    ImGui::TreePop();
}

image

Let me know if it all works for you. Additionally I just applied a bunch of Columns related changes, so interested in hearing feedback if anything broken/improved.

@ocornut ocornut closed this as completed Aug 20, 2017
@Flix01
Copy link
Author

Flix01 commented Aug 21, 2017

Let me know if it all works for you. Additionally I just applied a bunch of Columns related changes, so interested in hearing feedback if anything broken/improved.

Seems to work, and I'm not seeing anything broken so far... 👍

ocornut added a commit that referenced this issue Dec 10, 2017
…tSize(). Kept redirection function (will obsolete). (#246, #519, #1444)
NaleRaphael added a commit to NaleRaphael/codememo that referenced this issue Sep 9, 2020
- `CODE_CHAR_HEIGHT` is changed to 14 pixel.

- While setting `CodeSnippetWindow.height`, tailing space should be
  also considered. Currently it's set to 20 to prevent content of
  code snippet being truncated by window. Besides, we also have to
  call `imgui.set_next_window_content_size()` to determine the size
  of child region `code snippet` for this issue. Otherwise,
  horizontal won't show up no matter how the window size is resized.

  See also this issue: ocornut/imgui#519
NaleRaphael added a commit to NaleRaphael/codememo that referenced this issue Sep 9, 2020
- `CODE_CHAR_HEIGHT` is changed to 14 pixel.

- While setting `CodeSnippetWindow.height`, trailing space should
  be also considered. Currently it's set to 20 to prevent content
  of code snippet being truncated by window. Besides, we also have
  to call `imgui.set_next_window_content_size()` to determine the
  size of child region `code snippet` for this issue. Otherwise,
  horizontal won't show up no matter how the window size is resized.

  See also this issue: ocornut/imgui#519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants