I'm learning the wxWidgets GUI library, and I'm having trouble getting the wxListCtrl column width adjusted correctly.
-1 is automatically sized, and according to the documentation, it's supposed to size the column = to the largest element in the list control. That's not happening though. The list control has the following styles: wxLC_VRULES, wxLC_SINGLE_SEL, wxLC_NO_HEADER, wxLC_VIRTUAL, wxLC_REPORT. Minimum size: 200, 175. I dynamically update the size of the list according to the number of elements in a vector so that when the control requests an element it's within a valid range (i.e.: it doesn't crash the program).
Am I doing somthing wrong here? Is there a correct way to size the column? Am I missing somthing?
If any other information is needed, don't hesitate to ask for it.
The adjustment doesn't happen each time you insert an item. It happens when you explicitely call SetColumnWidth(...). Plus there is a difference between wxLIST_AUTOSIZE and wxLIST_AUTOSIZE_USEHEADER.
You can do that after each request / for each column. The reason why it is not done automatically is that it would flicker if you do that for like 1000 elements in a loop.