imgui icon indicating copy to clipboard operation
imgui copied to clipboard

BeginChild limit scrolling/item pushed on top

Open Frouk3 opened this issue 9 months ago • 2 comments

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:

Image

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();

Frouk3 avatar Apr 09 '25 18:04 Frouk3

I don’t understand your message. There is no question. Please make an effort formulating a question.

ocornut avatar Apr 09 '25 20:04 ocornut

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

Frouk3 avatar Apr 09 '25 21:04 Frouk3

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.

ocornut avatar Apr 14 '25 12:04 ocornut

Now it works like a charm, thanks!

Frouk3 avatar Apr 15 '25 11:04 Frouk3