can anyone give me a short explanation about how to sort by alphabetically the items of a wxListCtrl? I think that I found a way but it seems too complicated.
Thank You in advance!
can anyone give me a short explanation about how to sort by alphabetically the items of a wxListCtrl? I think that I found a way but it seems too complicated.
Thank You in advance!
You can set the style as mentioned in the comment and you also can use SortItems
method
like this:
listCtrl->SortItems(CompareFunction, 0);
When compare function should act similar to strcmp
:
int wxCALLBACK CompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr WXUNUSED(sortData))
{
if(item1<item2) return -1;
if(item1>item2) return 1;
if(item1==item2) return 0;
}