Desktop
- OS: Windows
- AppCUI Version: 1.244.0
Describe the bug
The ListView control fails to render columns correctly when more than 8 columns are added dynamically via AddColumn(). When the 9th column is added, the view appears to break:
- Most columns (indices 0-8) disappear.
- Only the last columns (after the 8-th) are visible.
- The text from the first column (the Item text) remains "pinned" to the left edge of the visible area, overlaying the wrong column header (e.g., "startmenuShortcut" appears under "Icon_").
To Reproduce
Steps to reproduce the behavior:
- Create a ListView using Factory::ListView::Create with no initial columns.
- In a loop, dynamically add 9 or more columns using list->AddColumn("...").
- Populate the list with items using list->AddItem() and item.SetText().
- Run the application; the ListView will not display the columns 0-8 correctly.
Expected behavior
The ListView should display all columns (scrollable if they exceed the window width) and maintain correct alignment between headers and row data, regardless of the column count.
Screenshots
- Working correctly (Limit = 8 Columns): The table displays headers and data correctly aligned.
- Broken (Limit > 8 Columns): Headers are missing, and data is misaligned.
Additional context
I verified this by manually limiting the loop in my code.
- If maxColumns = 8, it works perfectly.
- If maxColumns = 9 (or no limit), the rendering breaks immediately upon initialization.
Code:
TableViewer::TableViewer(Reference<MSIFile> _msi, const std::string& tableName) : Window(tableName, "d:c,w:95%,h:80%", WindowFlags::Sizeable)
{
// List View
this->list = Factory::ListView::Create(this, "x:0,y:0,w:100%,h:100%", {}, ListViewFlags::AllowMultipleItemsSelection);
// Beyond the maxColumns count, the columns will not be displayed (gui limitation)
int colCount = 0, maxColumns = 9;
auto def = _msi->GetTableDefinition(tableName);
if (def) {
for (const auto& col : def->columns) {
if (++colCount > maxColumns)
break;
// Format string: "n:ColName,a:l,w:20"
// n = name, a = align (left), w = width
AppCUI::Utils::LocalString<128> colFormat;
colFormat.Format("n:%s,a:l,w:20", col.name.c_str());
if (col.type & 0x8000) { // MSICOL_INTEGER check (simple mask)
colFormat.Format("n:%s,a:r,w:10", col.name.c_str());
}
list->AddColumn(colFormat.GetText());
}
}
auto rows = _msi->ReadTableData(tableName);
for (const auto& row : rows) {
if (row.empty())
continue;
// Add the item using the first column's data
auto item = list->AddItem(row[0]);
// Set texts for subsequent columns
for (size_t i = 1; i < row.size(); i++) {
if (i > maxColumns - 1)
break;
item.SetText((uint32) i, row[i]);
}
}
list->SetFocus();
}
Desktop
Describe the bug
The ListView control fails to render columns correctly when more than 8 columns are added dynamically via AddColumn(). When the 9th column is added, the view appears to break:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The ListView should display all columns (scrollable if they exceed the window width) and maintain correct alignment between headers and row data, regardless of the column count.
Screenshots
Additional context
I verified this by manually limiting the loop in my code.
Code: