Using 17.12 release of codeblocks.
I don't really understand what are those style and how to use them. We can/should only tick on style for one wxlistctrl?
Also I just can get one column. I don't know why but my items are not setting into columns they just fill the first line, then go to the next line and so on. Also each item have a predefined lenght that I cannot find how to change. I tried using listtest sample code, but it just doesn't work in wxsmith (see enclosed picture).
for ( int i = 0; i < 50; i++ )
{
ListCtrl1->InsertItem(i, wxString::Format("Item %d", i));
}
I tried many codes
wxListItem itemCol;
itemCol.SetText("Col1");
itemCol.SetImage(-1);
ListView1->InsertColumn(0, itemCol);
ListView1->SetColumnWidth(0, 100);
ListView1->InsertColumn(0,_("Col1"),wxLIST_FORMAT_LEFT,100);
ListView1->InsertItem(0,_("item1"));
ListView1->InsertItem(1,_("item1"));
ListView1->InsertItem(2,_("item1"));
ListView1->InsertItem(3,_("item1"));
ListView1->InsertItem(7,_("item1"));
ListView1->SetItem(0,0,_("col1ItemText"));
ListView1->AppendColumn("Col1");
But no matter I always have the enclosed picture result.
wxListCtrl can operate in one of four modes (see https://docs.wxwidgets.org/trunk/classwx_list_ctrl.html for more information)
- wxLC_LIST
- wxLC_REPORT
- wxLC_ICON
- wxLC_SMALL_ICON
You must select one (and only one) of these modes. The sample looks like a report, while your code looks like a list. You must use wxSmith to check wxLC_REPORT and uncheck the other three.
I use this code to add columns to a report:
Report->AppendColumn("CAN Id");
Report->AppendColumn("Len");
Report->AppendColumn("Data");
and this to add a line at the beginning of the report:
Report->InsertItem (0, "Column 0");
Report->SetItem(0, 1, "Column 1");
Report->SetItem(0, 2, "Column 2");
If you have more questions about wxListCtrl please ask in the wxWidgets forum.