How to auto scroll an item into sight?

Pierre Rouleau wrote:

Hi all,

I am using the FindItem method to search for a an item inside a
wxListCtrl list. How can i automatically scroll the found item into
sight if the item found is outside the portion of the list currently
seen in the window?

I tried SetFocus() but it did not help.

What should I read in WxWindows docs to lean more about
auto-scrolling?

Thanks for your time.

The following works for me:
  listctl.SetItemState(index,
wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED,
  
wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED)
  listctl.EnsureVisible(index)

Hope this helps,
Will Sadkin
Parlance Corporation
www.nameconnector.com

Will Sadkin wrote:

I am using the FindItem method to search for a an item inside a
wxListCtrl list. How can i automatically scroll the found item into
sight if the item found is outside the portion of the list currently
seen in the window?

I tried SetFocus() but it did not help.

The following works for me:
  listctl.SetItemState(index,
wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED,
  
wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED)
  listctl.EnsureVisible(index)

I works for me too. The trick is the EnsureVisible() call.

Hope this helps,

I does. Thanks!

Pierre