Hi All,
I am using a list control
class TestListCtrlPanel(wx.Panel,wxColumnSorterMixin):
how can make the sort on the list not case sensitive which is the case now.
cheers
···
Thomas Thomas
phone +64 7 855 8478
fax +64 7 855 8871
Hi All,
I am using a list control
class TestListCtrlPanel(wx.Panel,wxColumnSorterMixin):
how can make the sort on the list not case sensitive which is the case now.
cheers
Thomas Thomas
phone +64 7 855 8478
fax +64 7 855 8871
For example you define an event handler
for the header click
self.Bind(wx.EVT_LIST_COL_CLICK, self.OnHeaderClick, id = -1)
and here you call (in a way)
self.listctrl.SortItems(self.columnSorter)
def columnSorter(self, key1, key2):
if not self.sort_asc:
key1, key2 = key2, key1
item1 = self.listfiles[key1][self.nCol].lower()
item2 = self.listfiles[key2][self.nCol].lower()
if item1 == item2:
return 0
elif item1 < item2:
return -1
else:
return 1
On Thu, 9 Feb 2006 16:13:36 +1300, "Thomas Thomas" <thomas@eforms.co.nz> wrote:
Hi All,
I am using a list control
class TestListCtrlPanel(wx.Panel,wxColumnSorterMixin):
how can make the sort on the list not case sensitive which is the case now.
cheers
-----------------------------------------------------
Thomas Thomasphone +64 7 855 8478
fax +64 7 855 8871
--
Franz Steinhaeusler
better for example:
def MyColumnSorter(self, key1, key2):
col = self._col
ascending = self._colSortFlag[col]
#getitems
item1 = self.itemDataMap[key1][col]
item2 = self.itemDataMap[key2][col]
cmpVal = cmp(item1.lower(), item2.lower())
if ascending:
return cmpVal
else:
return -cmpVal
#overwrite this GetColumnSorter in your derived class
def GetColumnSorter(self):
"""Returns a callable object to be used for comparing column values when sorting."""
return self.MyColumnSorter
On Thu, 09 Feb 2006 11:27:53 +0100, Franz Steinhaeusler <franz.steinhaeusler@gmx.at> wrote:
On Thu, 9 Feb 2006 16:13:36 +1300, "Thomas Thomas" <thomas@eforms.co.nz> wrote:
Hi All,
I am using a list control
class TestListCtrlPanel(wx.Panel,wxColumnSorterMixin):
how can make the sort on the list not case sensitive which is the case now.
cheers
-----------------------------------------------------
Thomas Thomasphone +64 7 855 8478
fax +64 7 855 8871
--
Franz Steinhaeusler