Michele Petrazzo <michele.petrazzo unipex.it> wrote:
> How I can get the column where the user click on? I
see, into the demo
> "ListCtrl" / "ListCtrlVirtual",
that the event (passed by the
> EVT_LIST_ITEM_SELECTED) has the GetColumn() and the
Item retrieve has
> also the GetColumn, but all return always 0...
>
> code:
>
> event.GetColumn()
> listctrl.GetItem( event.m_itemIndex ) ) .GetColumn()
This only works in LC_REPORT view style, where 'self' is
the list
control.
self.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
def OnClick(self, event):
x = event.GetX()
self.column = None
for i in xrange(self.GetColumnCount()):
w = self.GetColumnWidth(i
if x <= w:
self.column = i
break
x -= w
event.Skip()
You can then get the selected item with self.column .
- Josiah
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|