HyperTreeList edit TextCtrls get stuck and don't get destroyed

Reproducible in both wxPython ‘2.9.4.0 msw (classic)’ and 3.0 classic… and the treelisttest_minimal_3.py found on this mailing list (also attached)… as well as the wxPython-demo-3.0.0.0 for HyperTreeList.

To reproduce, open the attached file, ‘gently’ click the label A2, when the textctrl is displayed, on the left side of the text, so the text becomes unselected. Next click the label A2 again (the static label, not the textctrl text). Now that textctrl won’t disappear.

I notice that the newly created textctrl isn’t the same width as the column, and I think the textctrl only stays visible when the click after the click to start editing is on the column label. So maybe the real issue is that the textctrl width isn’t covering up the static label such that another click event doesn’t get called.

Any ideas?

Forgot to post the demo code

treelisttest_minimal_3.py (3.01 KB)

···

On Wednesday, June 11, 2014 1:17:12 PM UTC-7, Nathan McCorkle wrote:

Reproducible in both wxPython ‘2.9.4.0 msw (classic)’ and 3.0 classic… and the treelisttest_minimal_3.py found on this mailing list (also attached)… as well as the wxPython-demo-3.0.0.0 for HyperTreeList.

To reproduce, open the attached file, ‘gently’ click the label A2, when the textctrl is displayed, on the left side of the text, so the text becomes unselected. Next click the label A2 again (the static label, not the textctrl text). Now that textctrl won’t disappear.

I notice that the newly created textctrl isn’t the same width as the column, and I think the textctrl only stays visible when the click after the click to start editing is on the column label. So maybe the real issue is that the textctrl width isn’t covering up the static label such that another click event doesn’t get called.

Any ideas?

Ok so I found an if statement that I was able to improve so if the current edit control (TextCtrl) column attribute is the same as the currently clicked column, a new editTimer won’t start.

In def OnMouse(self, event):

in this if statement:

    elif event.LeftUp():

        if self._lastOnSame:

            if item == self._current and self._curColumn != -1 and \

               self._owner.GetHeaderWindow().IsColumnEditable(self._curColumn) and \

               flags & (wx.TREE_HITTEST_ONITEMLABEL | wx.TREE_HITTEST_ONITEMCOLUMN) and \

               ((self._editCtrl!=None and column != self._editCtrl.column()) or self._editCtrl==None):

                self._editTimer.Start(_EDIT_TIMER_TICKS, wx.TIMER_ONE_SHOT)

I added the characters:

                                                                                    and \

               ((self._editCtrl!=None and column != self._editCtrl.column()) or self._editCtrl==None):

Now to move on to figuring out why the TextCtrl (editCtrl) isn’t the same width as the current column!

···

On Wednesday, June 11, 2014 1:35:17 PM UTC-7, Nathan McCorkle wrote:

Forgot to post the demo code

On Wednesday, June 11, 2014 1:17:12 PM UTC-7, Nathan McCorkle wrote:

Reproducible in both wxPython ‘2.9.4.0 msw (classic)’ and 3.0 classic… and the treelisttest_minimal_3.py found on this mailing list (also attached)… as well as the wxPython-demo-3.0.0.0 for HyperTreeList.

To reproduce, open the attached file, ‘gently’ click the label A2, when the textctrl is displayed, on the left side of the text, so the text becomes unselected. Next click the label A2 again (the static label, not the textctrl text). Now that textctrl won’t disappear.

I notice that the newly created textctrl isn’t the same width as the column, and I think the textctrl only stays visible when the click after the click to start editing is on the column label. So maybe the real issue is that the textctrl width isn’t covering up the static label such that another click event doesn’t get called.

Any ideas?

P.S. I applied the previous fix in the 3.0 Classic version of hypertreelist.py (wx-3.0-msw\wx\lib\agw\hypertreelist.py)

···

On Wednesday, June 11, 2014 3:18:39 PM UTC-7, Nathan McCorkle wrote:

Ok so I found an if statement that I was able to improve so if the current edit control (TextCtrl) column attribute is the same as the currently clicked column, a new editTimer won’t start.

In def OnMouse(self, event):

in this if statement:

    elif event.LeftUp():
        if self._lastOnSame:
            if item == self._current and self._curColumn != -1 and \
               self._owner.GetHeaderWindow().IsColumnEditable(self._curColumn) and \
               flags & (wx.TREE_HITTEST_ONITEMLABEL | wx.TREE_HITTEST_ONITEMCOLUMN) and \
               ((self._editCtrl!=None and column != self._editCtrl.column()) or self._editCtrl==None):
                self._editTimer.Start(_EDIT_TIMER_TICKS, wx.TIMER_ONE_SHOT)

I added the characters:

                                                                                    and \
               ((self._editCtrl!=None and column != self._editCtrl.column()) or self._editCtrl==None):

Now to move on to figuring out why the TextCtrl (editCtrl) isn’t the same width as the current column!

On Wednesday, June 11, 2014 1:35:17 PM UTC-7, Nathan McCorkle wrote:

Forgot to post the demo code

On Wednesday, June 11, 2014 1:17:12 PM UTC-7, Nathan McCorkle wrote:

Reproducible in both wxPython ‘2.9.4.0 msw (classic)’ and 3.0 classic… and the treelisttest_minimal_3.py found on this mailing list (also attached)… as well as the wxPython-demo-3.0.0.0 for HyperTreeList.

To reproduce, open the attached file, ‘gently’ click the label A2, when the textctrl is displayed, on the left side of the text, so the text becomes unselected. Next click the label A2 again (the static label, not the textctrl text). Now that textctrl won’t disappear.

I notice that the newly created textctrl isn’t the same width as the column, and I think the textctrl only stays visible when the click after the click to start editing is on the column label. So maybe the real issue is that the textctrl width isn’t covering up the static label such that another click event doesn’t get called.

Any ideas?