BeginChild(): Fixed BeginChild(const char*, ...) variation erroneously not applying the ID stack to the provided string to uniquely identify the child window. This was undoing an intentional change introduced in 1.50 and broken in 1.60. (#1698, #894, #713) + reworked the Begin/BeginChild comments in imgui.h.

This commit is contained in:
omar
2018-09-26 21:23:42 +02:00
parent 781a7950d7
commit a7d3ae8937
3 changed files with 20 additions and 9 deletions

View File

@ -4036,10 +4036,10 @@ static bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size
size.y = ImMax(content_avail.y + size.y, 4.0f);
SetNextWindowSize(size);
// Name
// Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value.
char title[256];
if (name)
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s", parent_window->Name, name);
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s_%08X", parent_window->Name, name, id);
else
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id);