mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Tables: fixed matching width of synchronized tables when only some (not all) instances have a vertical scrollbar. (#5920)
This commit is contained in:
		| @@ -5043,18 +5043,23 @@ static void ShowDemoWindowTables() | ||||
|     if (ImGui::TreeNode("Synced instances")) | ||||
|     { | ||||
|         HelpMarker("Multiple tables with the same identifier will share their settings, width, visibility, order etc."); | ||||
|  | ||||
|         static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings; | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_ScrollY", &flags, ImGuiTableFlags_ScrollY); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_SizingFixedFit", &flags, ImGuiTableFlags_SizingFixedFit); | ||||
|         for (int n = 0; n < 3; n++) | ||||
|         { | ||||
|             char buf[32]; | ||||
|             sprintf(buf, "Synced Table %d", n); | ||||
|             bool open = ImGui::CollapsingHeader(buf, ImGuiTreeNodeFlags_DefaultOpen); | ||||
|             if (open && ImGui::BeginTable("Table", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings)) | ||||
|             if (open && ImGui::BeginTable("Table", 3, flags, ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 5))) | ||||
|             { | ||||
|                 ImGui::TableSetupColumn("One"); | ||||
|                 ImGui::TableSetupColumn("Two"); | ||||
|                 ImGui::TableSetupColumn("Three"); | ||||
|                 ImGui::TableHeadersRow(); | ||||
|                 for (int cell = 0; cell < 9; cell++) | ||||
|                 const int cell_count = (n == 1) ? 27 : 9; // Make second table have a scrollbar to verify that additional decoration is not affecting column positions. | ||||
|                 for (int cell = 0; cell < cell_count; cell++) | ||||
|                 { | ||||
|                     ImGui::TableNextColumn(); | ||||
|                     ImGui::Text("this cell %d", cell); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user