diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 1dd2776d0..13b5931e5 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -4600,7 +4600,7 @@ static void ShowDemoWindowTables() static ImGuiTableFlags flags1 = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_ContextMenuInBody; PushStyleCompact(); - ImGui::CheckboxFlags("ImGuiTableFlags_ContextMenuInBody", (unsigned int*)&flags1, ImGuiTableFlags_ContextMenuInBody); + ImGui::CheckboxFlags("ImGuiTableFlags_ContextMenuInBody", &flags1, ImGuiTableFlags_ContextMenuInBody); PopStyleCompact(); // Context Menus: first example diff --git a/imgui_tables.cpp b/imgui_tables.cpp index de7b5ec18..d00c609b5 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1234,7 +1234,13 @@ void ImGui::EndTable() table->ColumnsAutoFitWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) if (table->EnabledMaskByIndex & ((ImU64)1 << column_n)) - table->ColumnsAutoFitWidth += TableGetColumnWidthAuto(table, &table->Columns[column_n]); + { + ImGuiTableColumn* column = &table->Columns[column_n]; + if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !(column->Flags & ImGuiTableColumnFlags_NoResize)) + table->ColumnsAutoFitWidth += column->WidthRequest; + else + table->ColumnsAutoFitWidth += TableGetColumnWidthAuto(table, column); + } // Update scroll if ((table->Flags & ImGuiTableFlags_ScrollX) == 0 && inner_window != outer_window) @@ -1457,7 +1463,7 @@ ImRect ImGui::TableGetCellBgRect(const ImGuiTable* table, int column_n) // Return the resizing ID for the right-side of the given column. ImGuiID ImGui::TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no) { - IM_ASSERT(column_n < table->ColumnsCount); + IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount); ImGuiID id = table->ID + 1 + (instance_no * table->ColumnsCount) + column_n; return id; }