mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Tables: Using same seed ID regardless of when using a child window or not.
This commit is contained in:
		@@ -216,6 +216,7 @@ bool    ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
 | 
				
			|||||||
    table->OuterRect = outer_rect;
 | 
					    table->OuterRect = outer_rect;
 | 
				
			||||||
    table->WorkRect = outer_rect;
 | 
					    table->WorkRect = outer_rect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // When not using a child window, WorkRect.Max will grow as we append contents.
 | 
				
			||||||
    if (use_child_window)
 | 
					    if (use_child_window)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent
 | 
					        // Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent
 | 
				
			||||||
@@ -241,11 +242,9 @@ bool    ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
 | 
				
			|||||||
        table->WorkRect = table->InnerWindow->WorkRect;
 | 
					        table->WorkRect = table->InnerWindow->WorkRect;
 | 
				
			||||||
        table->OuterRect = table->InnerWindow->Rect();
 | 
					        table->OuterRect = table->InnerWindow->Rect();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					
 | 
				
			||||||
    {
 | 
					    // Push a standardized ID for both child and not-child using tables, equivalent to BeginTable() doing PushID(label) matching
 | 
				
			||||||
        // WorkRect.Max will grow as we append contents.
 | 
					    PushOverrideID(instance_id);
 | 
				
			||||||
        PushID(instance_id);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Backup a copy of host window members we will modify
 | 
					    // Backup a copy of host window members we will modify
 | 
				
			||||||
    ImGuiWindow* inner_window = table->InnerWindow;
 | 
					    ImGuiWindow* inner_window = table->InnerWindow;
 | 
				
			||||||
@@ -1057,6 +1056,8 @@ void    ImGui::EndTable()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Layout in outer window
 | 
					    // Layout in outer window
 | 
				
			||||||
 | 
					    IM_ASSERT_USER_ERROR(inner_window->IDStack.back() == table->ID + table->InstanceCurrent, "Mismatching PushID/PopID!");
 | 
				
			||||||
 | 
					    PopID();
 | 
				
			||||||
    inner_window->WorkRect = table->HostWorkRect;
 | 
					    inner_window->WorkRect = table->HostWorkRect;
 | 
				
			||||||
    inner_window->SkipItems = table->HostSkipItems;
 | 
					    inner_window->SkipItems = table->HostSkipItems;
 | 
				
			||||||
    outer_window->DC.CursorPos = table->OuterRect.Min;
 | 
					    outer_window->DC.CursorPos = table->OuterRect.Min;
 | 
				
			||||||
@@ -1067,7 +1068,6 @@ void    ImGui::EndTable()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        PopID();
 | 
					 | 
				
			||||||
        ImVec2 item_size = table->OuterRect.GetSize();
 | 
					        ImVec2 item_size = table->OuterRect.GetSize();
 | 
				
			||||||
        item_size.x = table->ColumnsTotalWidth;
 | 
					        item_size.x = table->ColumnsTotalWidth;
 | 
				
			||||||
        ItemSize(item_size);
 | 
					        ItemSize(item_size);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user