Virtual ListCtrl not sortable by clicking the header?

I just realised, that as soon as I add Wx::LC_VIRTUAL to the style,
the list stops being sortable by clicking on the header. Are virtual
lists always unsortable by clicking on the header?

Regards,
Timo

Timo S. wrote:

I just realised, that as soon as I add Wx::LC_VIRTUAL to the style,
the list stops being sortable by clicking on the header. Are virtual
lists always unsortable by clicking on the header?

No, they are not unsortable, but you have to do the work yourself. In a
“normal” ListCtrl, the control has knowledge of all the contents, so can
help you. In a virtual ListCtrl, it doesn’t know all the contents as you
supply them on demand.

You need to handle the events for the clicking of the column headers
yourself (evt_list_col_click etc), and then re-order the contents
(data to be supplied by the virtual functions). So if you were using a
SQL call to populate the underlying data, you might add an ORDER BY
clause.

This for wxPython, but might be helpful:

http://code.activestate.com/recipes/426407/
http://archives.devshed.com/forums/python-122/sorting-wxlistctrl-with-lc-virtual-2218172.html

alex

Hi Alex,

hey, that’s sound promising. Thanks for pointing me into the right
direction. I’ll take a deeper look into it. I think it would be
usefull if this would be part of the documentation?

Regards,
Timo

Am 27.10.2009 um 15:00 schrieb Alex F.:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs