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

Question: Auto tile panels #7721

Open
prowindowsuser opened this issue Jun 21, 2024 · 1 comment
Open

Question: Auto tile panels #7721

prowindowsuser opened this issue Jun 21, 2024 · 1 comment

Comments

@prowindowsuser
Copy link

Version/Branch of Dear ImGui:

v1.90.8 WIP docking branch

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Windows10 + msvc

Full config/build information:

No response

Details:

All panels, bars are just BeginChild/EndChild in some other file, top and right "bars" is ImVec2(0,70) and ImVec2(250,0) because they never move&resize. I cant find a way to tile "panels" (theyre beginchild,endchild with ImVec2(0,0) somewhere else) in a way like this. I just want to be directed into right way to achive this tiling with beginchild/endchild style "panels". they are basic panels just some text and buttons inside. Thanks

Screenshots/Video:

im_sorry_for_this_issue

Minimal, Complete and Verifiable Example code:

// Simlified Example Code

// but actually there should be list of panels that should look like in the screenshot
Panel Panel1;
Panel Panel2;

ImGui::Begin("Main", NULL, WINDOW_FLAGS);
TopBar::Render(); //beginchild, endchild with text&buttons
LeftBar::Render();//beginchild, endchild with text&buttons

ImGui::Columns(2, "panels", false);
ImGui::SetColumnWidth(0 ,window_width/2);
ImGui::SetColumnWidth(1, window_width/2);

Panel1::Render();
ImGui::NextColumn();

Panel2::Render();
ImGui::Columns(1);
ImGui::End();
@GamingMinds-DanielC
Copy link
Contributor

To push you in the right direction:

  • You can query the available size with GetContentRegionAvail().
  • You can use SetCursorPos() to set the starting position and specify an explicit size for your child windows.

With that, you can manage the available space however you want.

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