wxMac: sorting occasionally gets opposite order in ListCtrl
Robert Roebling
robert at roebling.de
Fri Jun 1 00:32:15 PDT 2007
Kevin Ollivier wrote:
> Robert Roebling wrote:
>
> >
> >> One idea you and Robert might want to consider is moving away from
> >> using EVT_COLUMN_CLICKED to fire sort events. It seems overly low-
> >> level, considering that firing sort events is about the only purpose
> >> (AFAICT) served by that function. (i.e. you're checking for column
> >> clicked, but what you really want to know is 'should I sort the
> >> data'?) Instead, you might want to have a SetSortFunction
> >> (mySortCallback) or similar or an overridable virtual (e.g. OnSort
> >> (column, item1, item2)) and then let the underlying control fire that
> >> callback function when a sort is needed.
> >
> > The idea is that we have a data model that already did the sorting
> > so the wxDataViewCtrl should a) display the sorting arrow in the
> > column and report changes to it b) not do any sorting itself but
> > just take the order from the data model. Giving the wxDataViewCtrl
> > a sort function would be plan B - also because plan A already
> > works in the generic and the GTK+ code,
>
> Actually, the more I look at the wxDataViewCtrl code the more I have
> questions about how Hartwig resolved these matters with the OS X
> databrowser control. I guess I'll just wait until he submits his
> patch and we'll go from there.
If the current design fails then we can still move sorting into
the wxDataViewCtrl which seems to be easier under OS X (and
possible to do elsewhere), but I'd very much like to try.
In the end I'd like to be able to sort both by way of a sorted
model or by a sort funtion handed over to the wxDataViewCtrl.
Robert
More information about the wx-dev
mailing list