BeginChild limit scrolling/item pushed on top
Version/Branch of Dear ImGui:
Version 1.91.3, Branch: master (master/docking/etc.)
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx9.cpp
Compiler, OS:
Windows 10 + MSVC 2022
Full config/build information:
No response
Details:
My Issue/Question:
Limit the scrolling for main window before the child window begins
I'm calling the BeginChild after items were rendered
For the child background, I might guess it needs some tweaking in the colors
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
ImGui::Begin(...) // Casual ImGui Window setup
...
ImGui::SetNextWindowSize(ImVec2(ImGui::GetWindowContentRegionMax().x - ImGui::GetStyle().WindowPadding.x, 70.f));
ImGui::SetNextWindowPos(ImVec2(ImGui::GetWindowPos().x + ImGui::GetWindowContentRegionMin().x, ImGui::GetWindowPos().y + ImGui::GetWindowSize().y - 80.f));
ImGui::BeginChild("FileBar", ImVec2(ImGui::GetWindowContentRegionMax().x, 40.f), ImGuiChildFlags_Borders);
ImGui::SetCursorPos(ImVec2(ImGui::GetContentRegionAvail().x - 110.f, ImGui::GetWindowContentRegionMax().y - 30.f));
if (ImGui::Button("OK", ImVec2(50, 25)))
{
printf("Explorer prompt was confirmed.");
}
ImGui::SameLine();
if (ImGui::Button("Cancel", ImVec2(50, 25)))
{
printf("Explorer prompt was canceled.");
}
ImGui::EndChild();
I don’t understand your message. There is no question. Please make an effort formulating a question.
I'll try
When trying to add a child window, and setting it's position with size at the bottom of the window, it will render items from main window to it's end, even passing through the child, main idea that child should act like a floating/docked window, perhaps due to order of drawing it acts like this, maybe child should go first before items
You will need a child window for the top part. In fact, you don't need a child window for the bottom part, since there are no scrolling elements in there. You only need a child window for the top part.
Now it works like a charm, thanks!