Changing the behavior of a wxListCtrl

I'm currently using a wxListCtrl as a beefed-up checklist. Items on the list can be dragged, but they don't really need to be select-able (that is, they don't need to be shown as selected). Is there a way to change the behavior of the control so that items are not hilited or focused when you click them? I've tried using event callbacks for selected, activated and focused, and explicitly setting the state to wxLIST_STATE_DONTCARE, but that doesn't seem to do anything.

RH

···

--
Got MAXScript?
http://www.scriptspot.com/rhyde/

Juste have a look at the wxListCtrl demo file. Here is part of the code
that prevent an item to be selected. I think that you can do the same with
focus.

def OnItemSelected(self, event):
    ##print event.GetItem().GetTextColour()
    self.currentItem = event.m_itemIndex
    self.log.WriteText("OnItemSelected: %s, %s, %s, %s\n" %
                       (self.currentItem,
                        self.list.GetItemText(self.currentItem),
                        self.getColumnText(self.currentItem, 1),
                        self.getColumnText(self.currentItem, 2)))
    if self.currentItem == 10:
        self.log.WriteText("OnItemSelected: Veto'd selection\n")
        #event.Veto() # doesn't work
        # this does
        self.list.SetItemState(10, 0, wxLIST_STATE_SELECTED)
    event.Skip()

You just need to do:

def OnItemSelected(self, event):
    self.currentItem = event.m_itemIndex
    self.list.SetItemState(self.currentItem, 0, wxLIST_STATE_SELECTED)
    event.Skip()

It should work.

···

On Thursday 09 October 2003 21:23, Roger Hyde wrote:

I'm currently using a wxListCtrl as a beefed-up checklist. Items on the
list can be dragged, but they don't really need to be select-able (that
is, they don't need to be shown as selected). Is there a way to change
the behavior of the control so that items are not hilited or focused
when you click them? I've tried using event callbacks for selected,
activated and focused, and explicitly setting the state to
wxLIST_STATE_DONTCARE, but that doesn't seem to do anything.

--
   Frederic

   http://linux.gbiloba.org