Timo Springmann
2009-Oct-25 23:14 UTC
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
Alex Fenton
2009-Oct-27 14:00 UTC
[wxruby-users] Virtual ListCtrl not sortable by clicking the header?
Timo Springmann 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
Timo Springmann
2009-Oct-27 14:16 UTC
[wxruby-users] Virtual ListCtrl not sortable by clicking the header?
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 Fenton:> Timo Springmann 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 > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users