@ -324,6 +324,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
IM_ASSERT ( table - > ColumnsCount = = columns_count & & " BeginTable(): Cannot change columns count mid-frame while preserving same ID " ) ;
// Fix flags
table - > IsDefaultSizingPolicy = ( flags & ImGuiTableFlags_SizingMask_ ) = = 0 ;
flags = TableFixFlags ( flags , outer_window ) ;
// Initialize
@ -335,7 +336,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
table - > ColumnsCount = columns_count ;
table - > IsLayoutLocked = false ;
table - > InnerWidth = inner_width ;
table - > IsOuterRectMinFitX = ( outer_size . x = = 0.0f ) & & ( use_child_window = = false ) ; // Will be set to false later if there are any Stretch column.
table - > UserOuterSize = outer_size ;
// When not using a child window, WorkRect.Max will grow as we append contents.
if ( use_child_window )
@ -356,6 +357,10 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
if ( override_content_size . x ! = FLT_MAX | | override_content_size . y ! = FLT_MAX )
SetNextWindowContentSize ( ImVec2 ( override_content_size . x ! = FLT_MAX ? override_content_size . x : 0.0f , override_content_size . y ! = FLT_MAX ? override_content_size . y : 0.0f ) ) ;
// Reset scroll if we are reactivating it
if ( ( table_last_flags & ( ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY ) ) = = 0 )
SetNextWindowScroll ( ImVec2 ( 0.0f , 0.0f ) ) ;
// Create scrolling region (without border and zero window padding)
ImGuiWindowFlags child_flags = ( flags & ImGuiTableFlags_ScrollX ) ? ImGuiWindowFlags_HorizontalScrollbar : ImGuiWindowFlags_None ;
BeginChildEx ( name , instance_id , outer_rect . GetSize ( ) , false , child_flags ) ;
@ -1031,8 +1036,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
// [Part 8] Lock actual OuterRect/WorkRect right-most position.
// This is done late to handle the case of fixed-columns tables not claiming more widths that they need.
// Because of this we are careful with uses of WorkRect and InnerClipRect before this point.
if ( table - > RightMostStretchedColumn ! = - 1 )
table - > IsOuterRectMinFitX = false ;
table - > IsOuterRectMinFitX = ( table - > UserOuterSize . x = = 0.0f ) & & table - > RightMostStretchedColumn = = - 1 & & ( table - > InnerWindow = = table - > OuterWindow ) ;
if ( table - > IsOuterRectMinFitX )
{
table - > OuterRect . Max . x = table - > WorkRect . Max . x = unused_x1 ;
@ -1338,6 +1342,11 @@ void ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags, flo
ImGuiTableColumn * column = & table - > Columns [ table - > DeclColumnsCount ] ;
table - > DeclColumnsCount + + ;
// Assert when passing a width or weight if policy is entirely left to default, to avoid storing width into weight and vice-versa.
// Give a grace to users of ImGuiTableFlags_ScrollX.
if ( table - > IsDefaultSizingPolicy & & ( flags & ImGuiTableColumnFlags_WidthMask_ ) = = 0 & & ( flags & ImGuiTableFlags_ScrollX ) = = 0 )
IM_ASSERT ( init_width_or_weight < = 0.0f & & " Can only specify width/weight if sizing policy is set explicitely in either Table or Column. " ) ;
// When passing a width automatically enforce WidthFixed policy
// (whereas TableSetupColumnFlags would default to WidthAuto if table is not Resizable)
if ( ( flags & ImGuiTableColumnFlags_WidthMask_ ) = = 0 & & init_width_or_weight > 0.0f )