Associating data with wxListCtrl in virtual mode
Andreas Micheler
Andreas.Micheler at Student.Uni-Augsburg.de
Mon Dec 11 23:11:11 PST 2006
Lloyd wrote:
> Thanks Andreas.
>
> What I understood from your code is, when a mouse click event occurs it
> gets the index of the currently selected item and it returns the data
> from the Array (based on the index).
>
> But my case is different! What I actually want is -
>
> I have some column headers, and when the user clicks on the column
> header I want to sort the list based on that column. In this case each
> time the list is sorted, the index which returns will be changed for the
> same data in the raw! (Because the raw position shuffles).
>
> If it was not in wxLC_VIRTUAL mode I could have used
> wxListCtrl::SetItemData() and wxListCtrl::GetItemData()
>
>
> Any suggestions?
When you sort your column,
can't you just sort an array (while sorting your column),
which contains the row number?
You'd probably have to write some special sort function,
which simultanously sorts two things,
but it will work, I think.
Then you can access your objarr indirectly via your row array.
Cheers,
Andreas
More information about the wx-users
mailing list