CustomTreeControl - editing labels

I am having a problem with editing the labels of a new CustomTreeControl.
Attached is a runnable example that demonstrates the problem on my machine.

To reproduce the behavoir do the following;

1) Right click on a tree item labelled "Parent: n"
- this should append a new item and the TextCtrl set to edit mode.
The description should default to "MyNewItem"
- On my system is I simply press "return" to accept this label, the
tree is refreshed, but the value is displayed as simply empty or '??'
- If I type multiple words where the total length is greater that 15
characters, the first two characters are replaced with '??' followed
by the rest of the string.
- note that the textctrl is positioned in the expected location

2) If you right click on the an item labelled "Parent: x Child:x", the
text box opens in the top left hand corner - an unexpected location

Am I missing something ?

On tracing this thru the system, the problem seems to be "hidden" in
the 'C++' code. The value is passed to the TextCtrl's "SetValue"
method, but an immediate call to .GetValue or .Value after this shows
the erroreous result (ie, '??')

Is this somehow related to unicode ?

System specs are;
Python 2.5.2
wxPython 2.8.9.1 ansi
Tested running Win2k3 and WinXp

LabelEditing.py (2.12 KB)

Hello Geoff,

I’m afraid to be of little help as I have so little experience. Nevertheless I tried out your code and here are my findings (see the attached picture for a screen shot and see my own configuration below):

  1. I can’t reproduce the ??

  2. The labels can be very long without problem

  3. Indeed, you get this “top left corner” label positioning where the “MyNewItem” label gets squeezed. But it also appears in the attached example with parent 2. So my deduction is that this case appears whenever you try to add an item to an existing item that has not yet an expansion (i.e. trying to add an item to a leaf item).

  4. Strangely enough, as you may see in the StdOut/StdErr window, you have - in this case - many “ending label edit” in a row instead of start/stop successions.

Maybe your remark on unicode is a valid one. My configuration is:

Dell Inspiron 5100, Pentium 4, 2.4 GHz, 512MB RAM

Windows XP Home Edition Version 2002 Service Pack 3

Python 2.5.2

wxPython 2.8.8.1 (msw-unicode)

IDLE 1.2.2

Regards, Rene

···

On Mon, Dec 29, 2008 at 8:20 PM, geoff imageguy1206@gmail.com wrote:

I am having a problem with editing the labels of a new CustomTreeControl.
Attached is a runnable example that demonstrates the problem on my machine.

To reproduce the behavoir do the following;

  1. Right click on a tree item labelled “Parent: n”
  • this should append a new item and the TextCtrl set to edit mode.
    The description should default to “MyNewItem”

  • On my system is I simply press “return” to accept this label, the
    tree is refreshed, but the value is displayed as simply empty or ‘??’

  • If I type multiple words where the total length is greater that 15

characters, the first two characters are replaced with ‘??’ followed
by the rest of the string.

  • note that the textctrl is positioned in the expected location
  1. If you right click on the an item labelled “Parent: x Child:x”, the

text box opens in the top left hand corner - an unexpected location

Am I missing something ?

On tracing this thru the system, the problem seems to be “hidden” in
the ‘C++’ code. The value is passed to the TextCtrl’s “SetValue”

method, but an immediate call to .GetValue or .Value after this shows
the erroreous result (ie, ‘??’)

Is this somehow related to unicode ?

System specs are;
Python 2.5.2
wxPython 2.8.9.1 ansi

Tested running Win2k3 and WinXp


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Thanks Rene.

I tried the wxPython 2.8.8.1 ansi and got the same result, so decided
to try the unicode version and that seems to work fine.

Hopefully switching versions of wxpython (ansi -> unicode) won't
create any other major issues.

g.

Hello Geoff.

I’m glad to hear that. So at least half of your problem is solved.

I can’t tell about switching ansi → unicode. I’m too new.

Hope you’ll get an answer to the other half of your problem.

Good work, Rene

···

On Tue, Dec 30, 2008 at 1:20 PM, geoff imageguy1206@gmail.com wrote:

Thanks Rene.

I tried the wxPython 2.8.8.1 ansi and got the same result, so decided
to try the unicode version and that seems to work fine.

Hopefully switching versions of wxpython (ansi → unicode) won’t
create any other major issues.

g.


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users