[wxPython] Virtual Lists calls OnGetItemText too often....

I played a bit with Virtual Lists and figured out, that the
access scheme is quite inefficient, when the selection changes.

What happens: each time the selection is changed (e.g. by moving
with the cursor keys), ALL visible items on the screen are accessed.

To test this, I have modified VirtualListCtrl that counts the
calls to OnGetItemText and OnGetItemImage.

I wonder if this is a problem with wxPython or a general wxWindows
problem...

Michael

VirtualListCtrl.py (1014 Bytes)

···

--
      ''''\
     ` c-@@
     ` >
      \_ V

I played a bit with Virtual Lists and figured out, that the
access scheme is quite inefficient, when the selection changes.

What happens: each time the selection is changed (e.g. by moving
with the cursor keys), ALL visible items on the screen are accessed.

I think it is by design. If your list is showing very dynamic data then you
would want it to be updated as soon as it changes. On MSW at least it even
updates the text when you move the mouse over it. Also, on MSW the update
messages are coming from windows itself, wxWindows is only responding to
them by calling OnGetItemText, etc.

···

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

Robin Dunn wrote:

I played a bit with Virtual Lists and figured out, that the
access scheme is quite inefficient, when the selection changes.

What happens: each time the selection is changed (e.g. by moving
with the cursor keys), ALL visible items on the screen are accessed.

I think it is by design. If your list is showing very dynamic data then you
would want it to be updated as soon as it changes.

I don't think so, because it is *only* redrawing the one selected line.
It is *not* redrawing all the rest -- but still, it accesses all visible
cells.... I'd consider this a bug.

On MSW at least it even
updates the text when you move the mouse over it. Also, on MSW the update
messages are coming from windows itself, wxWindows is only responding to
them by calling OnGetItemText, etc.

that's another issue :wink:

Michael

···

--
      ''''\
     ` c-@@
     ` >
      \_ V

>>I played a bit with Virtual Lists and figured out, that the
>>access scheme is quite inefficient, when the selection changes.
>>
>>What happens: each time the selection is changed (e.g. by moving
>>with the cursor keys), ALL visible items on the screen are accessed.
>
> I think it is by design. If your list is showing very dynamic data then

you

> would want it to be updated as soon as it changes.

I don't think so, because it is *only* redrawing the one selected line.
It is *not* redrawing all the rest -- but still, it accesses all visible
cells.... I'd consider this a bug.

Well enter a bug report about it then. You may also want to join wx-dev and
send a note about it there.

···

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