scrolling a ListCtrl programmatically in Linux

Try self.list.EnsureVisible(self.currentItem)

···

At 10:08 PM 7/7/2008, you wrote:

I am running wxPython on Ubuntu. I have a wxListCtrl and I am
selecting an item and setting the focus based on pressing a next or
previous button using the following code:

self.list.SetItemState(self.currentItem,
wx.LIST_STATE_SELECTED|wx.LIST_STATE_FOCUSED,
wx.LIST_STATE_SELECTED|wx.LIST_STATE_FOCUSED)

where self.list is the ListCtrl and self.currentItem is an integer.
This seems to work, but the selected/focused item is often not
visible. I tried including a scroll command like this:

self.list.ScrollList(5,5)

but it doesn't seem to do anything. Is there another way to scroll
the list control or otherwise ensure that the selected item is
visible?

Thanks,

Ryan

That works beautifully. Thanks Phil. I really did read the docs. I
just missed that somehow.

···

On Tue, Jul 8, 2008 at 10:24 AM, Phil Mayes <olivebr@olivebr.com> wrote:

At 10:08 PM 7/7/2008, you wrote:

I am running wxPython on Ubuntu. I have a wxListCtrl and I am
selecting an item and setting the focus based on pressing a next or
previous button using the following code:

self.list.SetItemState(self.currentItem,
wx.LIST_STATE_SELECTED|wx.LIST_STATE_FOCUSED,
wx.LIST_STATE_SELECTED|wx.LIST_STATE_FOCUSED)

where self.list is the ListCtrl and self.currentItem is an integer.
This seems to work, but the selected/focused item is often not
visible. I tried including a scroll command like this:

self.list.ScrollList(5,5)

but it doesn't seem to do anything. Is there another way to scroll
the list control or otherwise ensure that the selected item is
visible?

Thanks,

Ryan

Try self.list.EnsureVisible(self.currentItem)

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