Catch events from other columns in wx.ListCtrl

Hi,

I am using the wx.ListCtrl in report mode with the TextEditMixin. I would
like to capture an event in the 3rd column in my list box so that I can
pop-up a custom dialog so that the user can change the value. This column
holds dates and there is no way that I can see to create an intuitive
embedded date and time picker ctrl into the ListCtrl, so I created a
separate dialog and then realized that I don't know how to catch the edit
event or tell which column I'm in.

I am using wxPython 2.8 with Python 2.4 on Windows XP.

Please help! Thanks a lot!

Mike Driscoll
Applications Specialist
MCIS - Technology Center

Mike Driscoll wrote:

Hi,

I am using the wx.ListCtrl in report mode with the TextEditMixin. I would
like to capture an event in the 3rd column in my list box so that I can
pop-up a custom dialog so that the user can change the value. This column
holds dates and there is no way that I can see to create an intuitive
embedded date and time picker ctrl into the ListCtrl, so I created a
separate dialog and then realized that I don't know how to catch the edit
event or tell which column I'm in.

I am using wxPython 2.8 with Python 2.4 on Windows XP.

You can probably do it by overriding TextEditMixin.OpenEditor in your derived class. If the col is the one you're interested in then do your own thing, otherwise just call the base class version of the method.

Another possibility would be to catch the EVT_LIST_BEGIN_LABEL_EDIT event (which is sent by OpenEditor) and if event.m_col is your special column then do the edit your way and call event.Veto(), otherwise call event.Allow()

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Catching the EVT_LIST_BEGIN_LABEL_EDIT event works for firing my custom
frame popup. This is probably a dumb question, but is there some kind of
event I can fire when that popped up frame is closed so I can update my
listctrl? Some days I really feel like a complete newbie.

Mike

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Thursday, June 21, 2007 5:05 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Catch events from other columns
in wx.ListCtrl

Mike Driscoll wrote:
> Hi,
>
> I am using the wx.ListCtrl in report mode with the
TextEditMixin. I
> would like to capture an event in the 3rd column in my list box so
> that I can pop-up a custom dialog so that the user can change the
> value. This column holds dates and there is no way that I
can see to
> create an intuitive embedded date and time picker ctrl into the
> ListCtrl, so I created a separate dialog and then realized that I
> don't know how to catch the edit event or tell which column I'm in.
>
> I am using wxPython 2.8 with Python 2.4 on Windows XP.

You can probably do it by overriding TextEditMixin.OpenEditor
in your derived class. If the col is the one you're
interested in then do your own thing, otherwise just call the
base class version of the method.

Another possibility would be to catch the
EVT_LIST_BEGIN_LABEL_EDIT event (which is sent by OpenEditor)
and if event.m_col is your special column then do the edit
your way and call event.Veto(), otherwise call
event.Allow()

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Mike Driscoll wrote:

Catching the EVT_LIST_BEGIN_LABEL_EDIT event works for firing my custom
frame popup. This is probably a dumb question, but is there some kind of
event I can fire when that popped up frame is closed so I can update my
listctrl?

You can make a custom event if you want to do it that way, but the easiest is to just catch the frame's EVT_CLOSE and then from that handler call some method in your listctrl class that does what you need.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!