For the wx.DataViewCtrl, I see that it has a method for GetSortingColumn() [1]. But I don't see the companion method for SetSortingColumn().
Is there some way to set the sort column from code?
Thanks,
Michael
[1] http://docs.wxwidgets.org/trunk/classwx_data_view_ctrl.html#ad7bf96b300c2266584be54de2a503271
I haven't tested this myself, but I found a SetSortOrder() method on DataViewColumn, which you can get an instance of with DataViewCtrl.GetColumn(), among other methods.
···
-----Original Message----- From: Michael Hipp
Sent: Friday, March 02, 2012 3:00 PM
To: wxPython Users
Subject: [wxPython-users] Set sort column for DataViewCtrl
For the wx.DataViewCtrl, I see that it has a method for GetSortingColumn() [1].
But I don't see the companion method for SetSortingColumn().
Is there some way to set the sort column from code?
Thanks,
Michael
[1]
http://docs.wxwidgets.org/trunk/classwx_data_view_ctrl.html#ad7bf96b300c2266584be54de2a503271
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
Thank you. That does appear to do what I asked. But I think it should be given an award for Worst Named Method Ever (tm). Here's the man page:
http://docs.wxwidgets.org/trunk/classwx_settable_header_column.html#a360deabbdb9ede8c9e616d460f276124
So it appears to learn which col is currently sorting:
control.GetSortingColumn()
And to change which col is currently sorting:
column.SetSortOrder()
Weird.
Thanks again,
Michael
···
On 2012-03-02 5:21 PM, Robert O'Connor wrote:
I haven't tested this myself, but I found a SetSortOrder() method on
DataViewColumn, which you can get an instance of with DataViewCtrl.GetColumn(),
among other methods.
-----Original Message----- From: Michael Hipp
Sent: Friday, March 02, 2012 3:00 PM
To: wxPython Users
Subject: [wxPython-users] Set sort column for DataViewCtrl
For the wx.DataViewCtrl, I see that it has a method for GetSortingColumn() [1].
But I don't see the companion method for SetSortingColumn().
Is there some way to set the sort column from code?
Thanks,
Michael
[1]
wxWidgets: wxDataViewCtrl Class Reference
It may not be as weird as you think, actually. Again, I haven't tested this to see what actually happens, but by setting the sort order on individual columns, the API is actually allowing you to sort multiple columns simultaneously. Something you couldn't do if there was a SetSortingColumn() method.
···
-----Original Message----- From: Michael Hipp
Sent: Friday, March 02, 2012 6:37 PM
To: wxpython-users@googlegroups.com
Subject: Re: [wxPython-users] Set sort column for DataViewCtrl
Thank you. That does appear to do what I asked. But I think it should be given
an award for Worst Named Method Ever (tm). Here's the man page:
http://docs.wxwidgets.org/trunk/classwx_settable_header_column.html#a360deabbdb9ede8c9e616d460f276124
So it appears to learn which col is currently sorting:
control.GetSortingColumn()
And to change which col is currently sorting:
column.SetSortOrder()
Weird.
Thanks again,
Michael
That is not at all what the docs seem to be saying. "Sets this column as the sort key for the associated control." Besides, what would become of the UI if multiple columns were sorting? I don't think that's in any HIG.
The asymmetry of the API seems odd. Hopefully I'm missing something.
Anyway, I plan to give it a whirl shortly. I like DataViewCtrl control so far; seems lightweight, and looks good.
Michael
···
On 2012-03-02 6:03 PM, Robert O'Connor wrote:
It may not be as weird as you think, actually. Again, I haven't tested this to
see what actually happens, but by setting the sort order on individual columns,
the API is actually allowing you to sort multiple columns simultaneously.
Something you couldn't do if there was a SetSortingColumn() method.
I can confirm this method works as advertised. To get the changed sorting to appear on screen you have to do a .Reset() on the store/model.
Thanks,
Michael
···
On 2012-03-02 5:21 PM, Robert O'Connor wrote:
I haven't tested this myself, but I found a SetSortOrder() method on
DataViewColumn, which you can get an instance of with DataViewCtrl.GetColumn(),
among other methods.
-----Original Message----- From: Michael Hipp
Sent: Friday, March 02, 2012 3:00 PM
To: wxPython Users
Subject: [wxPython-users] Set sort column for DataViewCtrl
For the wx.DataViewCtrl, I see that it has a method for GetSortingColumn() [1].
But I don't see the companion method for SetSortingColumn().
Is there some way to set the sort column from code?