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 scrolling region or selectable items inside Child #7541

Closed
PreetomBoro opened this issue Apr 29, 2024 · 3 comments
Closed

No scrolling region or selectable items inside Child #7541

PreetomBoro opened this issue Apr 29, 2024 · 3 comments

Comments

@PreetomBoro
Copy link

Version/Branch of Dear ImGui:

Version 1.90.5 WIP, Branch: docking

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Windows 10 + Mingw64

Full config/build information:

Dear ImGui 1.90.5 WIP (19046)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201703
define: _WIN32
define: _WIN64
define: __MINGW32__
define: __MINGW64__
define: __GNUC__=13
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000443
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C06
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1920.00,1051.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

Details:

My Issue/Question:

XXX (please provide as much context as possible)
I was trying out the 2nd example code in the readme.md

In the example the child gives a scrollable area bound but box with clickable items. But my code for some reason only gives text nothing more nothing less. Where have I gone wrong?

Screenshots/Video:

image

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
namespace XPLORER
{
    void ShowXplorer()
    {
        if (ImGui::Begin("Xplorer"))
        {
            ImGui::Text("This is a text");
            ImGui::Button("smash");
            ImGui::BeginChild("the sub window");

            for(int n=0; n<10; n++)
            {
                ImGui::Text("something %0d",n);
            }

            ImGui::EndChild();

        ImGui::End();
        }

        return;
    }
}
@PreetomBoro
Copy link
Author

PreetomBoro commented Apr 29, 2024

I feel super dumb. I called ImGui::Text() and wondering why it's not clickable.
But still trying to figure out why there isn't a scrollable region

@PreetomBoro
Copy link
Author

PreetomBoro commented Apr 29, 2024

image
added this code after the EndChild() (also the defination of HelpMaker as in the imgui_demo.cpp)and seems like it works

HelpMarker("Drag bottom border to resize. Double-click bottom border to auto-fit to vertical contents.");
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_FrameBg));
if (ImGui::BeginChild("ResizableChild", ImVec2(-FLT_MIN, ImGui::GetTextLineHeightWithSpacing() * 8), ImGuiChildFlags_Border | ImGuiChildFlags_ResizeY))
    for (int n = 0; n < 10; n++)
        ImGui::Text("Line %04d", n);
ImGui::PopStyleColor();
ImGui::EndChild();

@ocornut
Copy link
Owner

ocornut commented Apr 30, 2024

You may use ImGuiChildFlags_Border to add a border to the child, and ImGuiChildFlags_FrameStyle to automatically use the colors of e.g. FrameBg instead of WindowBg, which is what ListBox do.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants