Skip to content

Commit

Permalink
Tables: Return false when window is Collapsed (consistent + helpful f…
Browse files Browse the repository at this point in the history
…or doc) + Fix empty context menu.
  • Loading branch information
ocornut committed Dec 30, 2019
1 parent 3b2ce6c commit 046cd4b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7730,6 +7730,8 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
{
ImGuiContext& g = *GImGui;
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
IM_ASSERT(columns_count > 0 && columns_count < IMGUI_TABLE_MAX_COLUMNS && "Only 0..63 columns allowed!");
Expand Down Expand Up @@ -9414,12 +9416,13 @@ void ImGui::TableAutoHeaders()

// Context Menu
if (open_context_popup != INT_MAX)
{
table->IsContextPopupOpen = true;
table->ContextPopupColumn = (ImS8)open_context_popup;
table->InstanceInteracted = table->InstanceNo;
OpenPopup("##TableContextMenu");
}
if (table->Flags & (ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
{
table->IsContextPopupOpen = true;
table->ContextPopupColumn = (ImS8)open_context_popup;
table->InstanceInteracted = table->InstanceNo;
OpenPopup("##TableContextMenu");
}
}

// Emit a column header (text + optional sort order)
Expand Down

0 comments on commit 046cd4b

Please sign in to comment.