Tables
Fullfeatured replacement for old Columns API.
See Demo>Tables for demo code. See top of imgui_tables.cpp for general commentary.
See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags.
The typical call flow is:
1. Call BeginTable(), early out if returning false.
2. Optionally call TableSetupColumn() to submit column name/flags/defaults.
3. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows.
4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data.
5. Populate contents:
In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column.
If you are using tables as a sort of grid, where every column is holding the same type of contents,
you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex().
TableNextColumn() will automatically wraparound into the next row if needed.
IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column!
Summary of possible call flow:
TableNextRow() > TableSetColumnIndex(0) > Text("Hello 0") > TableSetColumnIndex(1) > Text("Hello 1") // OK
TableNextRow() > TableNextColumn() > Text("Hello 0") > TableNextColumn() > Text("Hello 1") // OK
TableNextColumn() > Text("Hello 0") > TableNextColumn() > Text("Hello 1") // OK: TableNextColumn() automatically gets to next row!
TableNextRow() > Text("Hello 0") // Not OK! Missing TableSetColumnIndex() or TableNextColumn()! Text will not appear!
5. Call EndTable()
Tables Fullfeatured replacement for old Columns API. See Demo>Tables for demo code. See top of imgui_tables.cpp for general commentary. See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags. The typical call flow is: 1. Call BeginTable(), early out if returning false. 2. Optionally call TableSetupColumn() to submit column name/flags/defaults. 3. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows. 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data. 5. Populate contents: In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column. If you are using tables as a sort of grid, where every column is holding the same type of contents, you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex(). TableNextColumn() will automatically wraparound into the next row if needed. IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column! Summary of possible call flow: TableNextRow() > TableSetColumnIndex(0) > Text("Hello 0") > TableSetColumnIndex(1) > Text("Hello 1") // OK TableNextRow() > TableNextColumn() > Text("Hello 0") > TableNextColumn() > Text("Hello 1") // OK TableNextColumn() > Text("Hello 0") > TableNextColumn() > Text("Hello 1") // OK: TableNextColumn() automatically gets to next row! TableNextRow() > Text("Hello 0") // Not OK! Missing TableSetColumnIndex() or TableNextColumn()! Text will not appear! 5. Call EndTable()