-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
BeginViewportSideBar disappears #6283
Comments
As the name implies, viewport side bars apply to the viewport--not the current window. As such your window overlaps with your viewport side bar and ends up covering it when it is brought to the front. The easiest route is to move your viewport side bar to before the Personally I'd also use As an aside, your other windows ( Your Here's your example tweaked with the above suggestions: ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetCurrentViewport(nullptr, (ImGuiViewportP*)viewport); // Set viewport explicitly so GetFrameHeight reacts to DPI changes
float height = ImGui::GetFrameHeight();
if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("Menu")) {
ImGui::MenuItem("Main menu bar", NULL, false, true);
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
}
if (ImGui::BeginViewportSideBar("StatusBar", viewport, ImGuiDir_Down, height, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar)) {
if (ImGui::BeginMenuBar()) {
ImGui::Text("status bar");
ImGui::EndMenuBar();
}
ImGui::End();
}
ImGuiID mainDockSpaceId = ImGui::DockSpaceOverViewport();
ImGuiWindowClass window_class;
window_class.DockNodeFlagsOverrideSet = ImGuiDockNodeFlags_NoTabBar;
ImGui::SetNextWindowClass(&window_class);
ImGui::Begin("Down", &show_another_window, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
ImGui::Text("Stats:");
ImGui::End();
ImGui::SetNextWindowClass(&window_class);
ImGui::Begin("Left", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
ImGui::Text("Stats:");
ImGui::End();
ImGui::SetNextWindowClass(&window_class);
ImGui::Begin("Right", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
ImGui::Text("Stats:");
ImGui::End();
static bool sFirstFrame = true;
if (sFirstFrame) {
sFirstFrame = false;
ImGui::DockBuilderRemoveNode(mainDockSpaceId);
ImGui::DockBuilderAddNode(mainDockSpaceId, ImGuiDockNodeFlags_None);
ImGuiID dock_id_up;
ImGuiID dock_id_down;
ImGuiID dock_id_left;
ImGuiID dock_id_right;
ImGui::DockBuilderSplitNode(mainDockSpaceId, ImGuiDir_Up, 0.5f, &dock_id_up, &dock_id_down);
ImGui::DockBuilderSplitNode(dock_id_up, ImGuiDir_Right, 0.5f, &dock_id_right, &dock_id_left);
ImGui::DockBuilderDockWindow("Down", dock_id_down);
ImGui::DockBuilderDockWindow("Left", dock_id_left);
ImGui::DockBuilderDockWindow("Right", dock_id_right);
ImGui::DockBuilderFinish(mainDockSpaceId);
} And here's the output after clicking around to adjust the splitters: |
Thank you very much!!! |
Branch: docking
Hi sorry another stupid question.
I created a BeginViewportSideBar on the bottom of the window and it is displayed correctly.
But when I press from any in the window it disappears.
screen.mov
Here the code:
The text was updated successfully, but these errors were encountered: