List Info

Thread: listctrl column




listctrl column
user name
2006-06-30 13:48:50
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()

Thanks,
Michele

------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org

listctrl column
user name
2006-06-30 16:02:18
Michele Petrazzo <michele.petrazzounipex.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-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )