Skip to content

Few bugs in the console log example #5721

@aybe

Description

@aybe

Config/Build Information:

Dear ImGui 1.87 (18700)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS
define: _WIN32
define: _WIN64
define: _MSC_VER=1930
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: NULL
io.BackendRendererName: NULL
io.ConfigFlags: 0x00000000
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00000008
 RendererHasVtxOffset
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,256
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Version/Branch of Dear ImGui:

Version: 1.87
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: Visual Studio
Operating System: Windows 10

My Issue/Question:

I'm writing my own console based on your example in the mega demo, I've found few issues on it.

Problem 1:

Add a bunch of entries so that the scrollbar becomes very small, you cannot scroll anymore because the window resize grip takes precedence:

TestDI_iHQ8NgWjSV

If you shrink it enough so that horizontal scrolling appears, the problem is fixed:

TestDI_AcBezstnak

To try address this in a consistent way, I added an empty TextUnformatted after EndChild and in Begin add the flag NoScrollbar:

TestDI_43c68B4aKP

That is already much better even though that now you always have an horizontal scrolling even if there's nothing to scroll.

Any idea on how to fix the problem more elegantly?

Problem 2:

Resizing the window when auto scroll is enabled will screw the vertical position.

When the scroll is say in the middle, all is good:

TestDI_YfiIYpFshJ

But see how when auto scroll is on, the scroll bar loses its position:

TestDI_Q1xBINT2uK

I have no idea on how to fix that one out.

Any tips are much appreciated, thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions