Any idea when horizontal scroll bar will be available? #246

Closed
opened 2015-06-18 07:36:42 +00:00 by nikmes · 8 comments
nikmes commented 2015-06-18 07:36:42 +00:00 (Migrated from github.com)
No description provided.
ocornut commented 2015-06-18 14:43:25 +00:00 (Migrated from github.com)

I was actually looking into some of that recently.
It should be quite easy to add.

There's a few problems to take care of, e.g. some clipping optimisations for huge block of texts are skipping on text width calculation. Scrolling is easy and free but calculating accurate size to have a reference point of how big is the contents, can sometimes be costly.

I was actually looking into some of that recently. It should be quite easy to add. There's a few problems to take care of, e.g. some clipping optimisations for huge block of texts are skipping on text width calculation. Scrolling is easy and free but calculating accurate size to have a reference point of how big is the contents, can sometimes be costly.
ocornut commented 2015-07-20 00:55:08 +00:00 (Migrated from github.com)

Note that you can easily hack some form of manual scrolling (without scrollbar) by positioning the cursor.
e.g.

static float x = 0.0f;
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)))
    x -= ImGui::GetIO().DeltaTime * 1000.0f;
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_RightArrow)))
    x += ImGui::GetIO().DeltaTime * 1000.0f;
ImGui::SetCursorPosX((float)(int)-x);
ImGui::BeginGroup();
...
Note that you can easily hack some form of manual scrolling (without scrollbar) by positioning the cursor. e.g. ``` cpp static float x = 0.0f; if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftArrow))) x -= ImGui::GetIO().DeltaTime * 1000.0f; if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_RightArrow))) x += ImGui::GetIO().DeltaTime * 1000.0f; ImGui::SetCursorPosX((float)(int)-x); ImGui::BeginGroup(); ... ```
nikmes commented 2015-07-20 06:33:20 +00:00 (Migrated from github.com)

Thanks! I ll give it a try.

On 20 July 2015 at 03:55, omar notifications@github.com wrote:

Note that you can easily hack some form of manual scrolling by positioning
the cursor.
e.g.

static float x = 0.0f;if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)))
x -= ImGui::GetIO().DeltaTime * 1000.0f;if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_RightArrow)))
x += ImGui::GetIO().DeltaTime * 1000.0f;ImGui::SetCursorPosX((float)(int)-x);ImGui::BeginGroup();
...

—
Reply to this email directly or view it on GitHub
https://github.com/ocornut/imgui/issues/246#issuecomment-122723424.

Best Regards
Nicholas Messaritis

Thanks! I ll give it a try. On 20 July 2015 at 03:55, omar notifications@github.com wrote: > Note that you can easily hack some form of manual scrolling by positioning > the cursor. > e.g. > > static float x = 0.0f;if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftArrow))) > x -= ImGui::GetIO().DeltaTime \* 1000.0f;if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_RightArrow))) > x += ImGui::GetIO().DeltaTime \* 1000.0f;ImGui::SetCursorPosX((float)(int)-x);ImGui::BeginGroup(); > ... > > — > Reply to this email directly or view it on GitHub > https://github.com/ocornut/imgui/issues/246#issuecomment-122723424. ## Best Regards Nicholas Messaritis
ocornut commented 2015-08-30 17:45:32 +00:00 (Migrated from github.com)

OK pretty much done with that.
The horizontal scrollbar is always off by default and has to be enabled using ImGuiWindowFlags_HorizontalScrollbar.

You can call SetNextWindowContentWidth(width) before Begin() to specify a desired width.
The change had more side-effects than effects, had to change a few things but it may introduce new bugs.

horizontal_scrollbar

horizontal_scrollbar2

OK pretty much done with that. The horizontal scrollbar is always off by default and has to be enabled using ImGuiWindowFlags_HorizontalScrollbar. You can call SetNextWindowContentWidth(width) before Begin() to specify a desired width. The change had more side-effects than effects, had to change a few things but it may introduce new bugs. ![horizontal_scrollbar](https://cloud.githubusercontent.com/assets/8225057/9568628/0f7fbbf6-4f47-11e5-9980-96fff3cb8151.gif) ![horizontal_scrollbar2](https://cloud.githubusercontent.com/assets/8225057/9568630/12adf78e-4f47-11e5-8795-a81784c18405.gif)
extrawurst commented 2015-08-30 17:47:29 +00:00 (Migrated from github.com)

@ocornut you are amazing... thank you!

@ocornut you are amazing... thank you!
herdigiorgi commented 2015-08-30 19:33:40 +00:00 (Migrated from github.com)

@ocornut WOW!! Thanks! thanks!

@ocornut WOW!! Thanks! thanks!
nikmes commented 2015-09-01 08:23:26 +00:00 (Migrated from github.com)

Looks cool. I will upgrade my code tonight :) Thanks a lot

Looks cool. I will upgrade my code tonight :) Thanks a lot
nikmes commented 2016-03-15 14:30:05 +00:00 (Migrated from github.com)
https://www.facebook.com/2dleveleditor/?ref=aymt_homepage_panel
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#246
No description provided.