ListBox: Append vs Insert

Is it normal for the behavior of ListBox.Append() to add an item to
the beginning of the list instead of the end?
Is this not more of a prepend operation?

I've replaced calls to Append() with Insert(textItem, Listbox.Count)-
which gives me the behavior I expected with Append.

Hi,

Is it normal for the behavior of ListBox.Append() to add an item to
the beginning of the list instead of the end?

No, not unless the listbox is empty then the end is also the beginning

Is this not more of a prepend operation?

I've replaced calls to Append() with Insert(textItem, Listbox.Count)-
which gives me the behavior I expected with Append.

Append should add it to the end and it does on my machine.

What OS, version of wxPython, and architecture (32/64 bit) are you using?

Cody

···

On Thu, Dec 17, 2009 at 2:27 PM, cappy2112 <cappy2112@gmail.com> wrote:

No, not unless the listbox is empty then the end is also the beginning

I don't think one can see where an item is inserted in this case,
since it is the only one.
When adding subsequent items, I can easily see them being added to the
beginning.

What OS, version of wxPython, and architecture (32/64 bit) are you using?

XP, SP2. '2.8.9.1 (msw-ansi)', 32-bit. We use Python 2.3- so I can't
go to any newer versions of wx because there are no binaries for 2.3
after this version of wx.

I also see this behavior on my laptop, which is running Windows 7, 32-
bit, probably a lot more recent version of wxPython, because I am
using Python 2.5 on the laptop.

Hi,

test.py (763 Bytes)

···

On Thu, Dec 17, 2009 at 2:41 PM, cappy2112 <cappy2112@gmail.com> wrote:

XP, SP2. '2.8.9.1 (msw-ansi)', 32-bit. We use Python 2.3- so I can't
go to any newer versions of wx because there are no binaries for 2.3
after this version of wx.

I also see this behavior on my laptop, which is running Windows 7, 32-
bit, probably a lot more recent version of wxPython, because I am
using Python 2.5 on the laptop.

On my windows xp box py2.5.4 wx2.10.1 this behavior is not
reproducible, so not sure what else I can tell you.

See attached test app.

Cody

Hi,

···

On Thu, Dec 17, 2009 at 3:08 PM, Cody Precord <codyprecord@gmail.com> wrote:

Hi,

On Thu, Dec 17, 2009 at 2:41 PM, cappy2112 <cappy2112@gmail.com> wrote:

XP, SP2. '2.8.9.1 (msw-ansi)', 32-bit. We use Python 2.3- so I can't
go to any newer versions of wx because there are no binaries for 2.3
after this version of wx.

I also see this behavior on my laptop, which is running Windows 7, 32-
bit, probably a lot more recent version of wxPython, because I am
using Python 2.5 on the laptop.

On my windows xp box py2.5.4 wx2.10.1 this behavior is not
reproducible, so not sure what else I can tell you.

Actually one thing did come to mind, are you using any style flags on
your listbox?

Using LB_SORT would modify the behavior of how things are added to the
list by Append and could explain what your seeing

Cody

Actually one thing did come to mind, are you using any style flags on
your listbox?

Yes, but not the sort style.

I am using these
wx.TE_READONLY|wx.LB_HSCROLL|wx.LB_MULTIPLE

Hi,

Actually one thing did come to mind, are you using any style flags on
your listbox?

Yes, but not the sort style.

I am using these
wx.TE_READONLY|wx.LB_HSCROLL|wx.LB_MULTIPLE

TE_READONLY is a TextCtrl style flag so you shouldnt use it with a list box
and by coincidence look at this

import wx
wx.TE_READONLY

16

wx.LB_SORT

16

Cody

···

On Fri, Dec 18, 2009 at 3:10 PM, cappy2112 <cappy2112@gmail.com> wrote:

TE_READONLY is a TextCtrl style flag so you shouldnt use it with a list box
and by coincidence look at this

That explains it all. I had originally used a TextCtrl then switched
to a ListBox without changing all of the style options.

Thanks