How to scroll wxListListCtrl into view ?

Hi @all,

I have some problems how to scroll the wxListCtrl into view.
I put to buttons next to the control, one for pushing items up and one for
pushing them down.
Works good, but when an item is pushed out of view I want the
wxListCtrls-viewable area to be updated into the clients viewable
rectangle.

Any hints?

Best regards,
Marcus.

mkimpenhaus@plus.de wrote:

Hi @all,

I have some problems how to scroll the wxListCtrl into view.
I put to buttons next to the control, one for pushing items up and one for pushing them down.
Works good, but when an item is pushed out of view I want the wxListCtrls-viewable area to be updated into the clients viewable rectangle.

  listctrl.EnsureVisible(item)

···

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

listctrl.EnsureVisible(item)

I am dealing with a similar problem but I want to recreate the entire
listctrl contents when I change the underlying list. I want to have it
positioned with the same item at the top after it is filled up again. There
doesn't seem to be any way to do this: there is no SetTopItem() or position
call of any kind other than EnsureVisible().

Am I missing something?
-Rick King
Southfield MI

Here's what I came up with after some queries to the list plus
experimentation. It basically selects the row and scrolls the so the item
is visible. The value 50 is a "fudge factor", found by experimentation.
You may have to change it.

I *hope* someone else has a better solution, so I can use it too! :wink:

        if self.ClientID <> 0:
            Index = self.itemkey[self.ClientID]
            self.ClientList.SetItemState(Index, wxLIST_STATE_SELECTED,
wxLIST_STATE_SELECTED)
            height = self.ClientList.GetItemRect(Index, code =
wxLIST_RECT_BOUNDS)[1]
            self.ClientList.ScrollList(0, height-50)

Hope this helps,

John Hopkins
Hopkins IT

···

-----Original Message-----
From: Rick King [mailto:rickbking@comcast.net]
Sent: Thursday, June 26, 2003 8:56 AM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] How to scroll wxListListCtrl into view ?

listctrl.EnsureVisible(item)

I am dealing with a similar problem but I want to recreate the entire
listctrl contents when I change the underlying list. I want to have it
positioned with the same item at the top after it is filled up again. There
doesn't seem to be any way to do this: there is no SetTopItem() or position
call of any kind other than EnsureVisible().

Am I missing something?
-Rick King
Southfield MI

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Here's what I came up with after some queries to the list plus
experimentation.

Thanks, but I rejected using ScrollList because its implementation is
limited to Windows.

Its amazing the listctrl is so different from listbox.
-Rick King
Southfield MI