mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Tables: Return false when window is Collapsed (consistent + helpful for doc) + Fix empty context menu.
This commit is contained in:
		@@ -155,6 +155,8 @@ bool    ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    ImGuiContext& g = *GImGui;
 | 
					    ImGuiContext& g = *GImGui;
 | 
				
			||||||
    ImGuiWindow* outer_window = GetCurrentWindow();
 | 
					    ImGuiWindow* outer_window = GetCurrentWindow();
 | 
				
			||||||
 | 
					    if (outer_window->SkipItems) // Consistent with other tables + beneficial side effect that assert on miscalling EndTable() will be more visible.
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Sanity checks
 | 
					    // Sanity checks
 | 
				
			||||||
    IM_ASSERT(columns_count > 0 && columns_count < IMGUI_TABLE_MAX_COLUMNS && "Only 0..63 columns allowed!");
 | 
					    IM_ASSERT(columns_count > 0 && columns_count < IMGUI_TABLE_MAX_COLUMNS && "Only 0..63 columns allowed!");
 | 
				
			||||||
@@ -1839,12 +1841,13 @@ void    ImGui::TableAutoHeaders()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Context Menu
 | 
					    // Context Menu
 | 
				
			||||||
    if (open_context_popup != INT_MAX)
 | 
					    if (open_context_popup != INT_MAX)
 | 
				
			||||||
    {
 | 
					        if (table->Flags & (ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
 | 
				
			||||||
        table->IsContextPopupOpen = true;
 | 
					        {
 | 
				
			||||||
        table->ContextPopupColumn = (ImS8)open_context_popup;
 | 
					            table->IsContextPopupOpen = true;
 | 
				
			||||||
        table->InstanceInteracted = table->InstanceNo;
 | 
					            table->ContextPopupColumn = (ImS8)open_context_popup;
 | 
				
			||||||
        OpenPopup("##TableContextMenu");
 | 
					            table->InstanceInteracted = table->InstanceNo;
 | 
				
			||||||
    }
 | 
					            OpenPopup("##TableContextMenu");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Emit a column header (text + optional sort order)
 | 
					// Emit a column header (text + optional sort order)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user