Edit events on ListCtrl

Here we go! A bit of hacking the demo.
Still showing the problem.
A.

Robin Dunn wrote:

listctrl_editevents.py (3.82 KB)

···

Andrea De Angeli wrote:

Hello fellows,

I am currently facing ListCtrls. I need to trigger EDIT events, BEGIN and END.
Looks like an easy task but what I get is: NO trigger on wx.EVT_LIST_BEGIN_LABEL_EDIT and wx.EVT_LIST_END_LABEL_EDIT triggered twice.
Same behaviour on windows XP and Linux (wxPython 2.6.xx - various versions).

Do I do something badly wrong? Can someone point me in the right direction?

I expect that the TextEditMixin is preventing the BEGIN event because it is intercepting the events that would normally trigger the native edit capabilities. It looks like TextEditMixin is artificially sending the END event itself, but I'm not sure why it is sending two.

Just for the fun of it, I cut and pasted my class definition below.

It's better to make a small but complete sample app to show the problem, then people can run it themselves to see the problem.

Thanks a lot! Now it works as expected...

Andrea

Robin Dunn wrote:

Andrea De Angeli wrote:

Here we go! A bit of hacking the demo.
Still showing the problem.

Ok, I've fixed the double END event problem in TextEditMixin by checking if the editor was already hidden before continuing with the CloseEditor method. I've also added code to OpenEditor to send the BEGIN event and to not allow the opening of the editor to continue if the event handler doesn't allow it. This will be in the next release, or you can get a new copy of wxPython/wx/lib/mixins/listctrl.py from CVS.

Chiacchiera con i tuoi amici in tempo reale! Yahoo fa parte della famiglia di brand Yahoo.