Scroll listbox to show current active selection

I've got a listbox control that I've populated with about 500 items.
When certain actions are performed in another control I need to alter
the currently selected item in the listbox. That part works fine, I
just make a call the the SetStringSelection method of the listbox.
The problem is that when I select an item in the listbox that is
scrolled off the screen that item does not automatically scroll into
the visible portion of the listbox. So, the user is left to click on
the listbox scrollbar until they finally find which item was selected.
Is there a way to have the listbox scroll itself when the selection
changes so that the new selection is in the visible window?

-Isaac

Have you tried wx.ListBox.EnsureVisible(selectionInt)? This will of
course require getting the index of the item you are selecting.

···

-----Original Message-----
From: Isaac Wagner [mailto:geekyisaac@gmail.com]
Sent: Monday, January 22, 2007 12:56 PM
To: wxpython-users@lists.wxwidgets.org
Subject: [wxPython-users] Scroll listbox to show current active
selection

I've got a listbox control that I've populated with about 500 items.
When certain actions are performed in another control I need to alter
the currently selected item in the listbox. That part works fine, I
just make a call the the SetStringSelection method of the listbox.
The problem is that when I select an item in the listbox that is
scrolled off the screen that item does not automatically scroll into
the visible portion of the listbox. So, the user is left to click on
the listbox scrollbar until they finally find which item was selected.
Is there a way to have the listbox scroll itself when the selection
changes so that the new selection is in the visible window?

-Isaac

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

Yes, I've tried that and it doesn't scroll the listbox. Thanks for
the suggestion.

···

On 1/22/07, Rooney, Mike (ext. 324) <mxr@qvii.com> wrote:

Have you tried wx.ListBox.EnsureVisible(selectionInt)? This will of
course require getting the index of the item you are selecting.

-----Original Message-----
From: Isaac Wagner [mailto:geekyisaac@gmail.com]
Sent: Monday, January 22, 2007 12:56 PM
To: wxpython-users@lists.wxwidgets.org
Subject: [wxPython-users] Scroll listbox to show current active
selection

I've got a listbox control that I've populated with about 500 items.
When certain actions are performed in another control I need to alter
the currently selected item in the listbox. That part works fine, I
just make a call the the SetStringSelection method of the listbox.
The problem is that when I select an item in the listbox that is
scrolled off the screen that item does not automatically scroll into
the visible portion of the listbox. So, the user is left to click on
the listbox scrollbar until they finally find which item was selected.
Is there a way to have the listbox scroll itself when the selection
changes so that the new selection is in the visible window?

-Isaac

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

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

Isaac Wagner wrote:

Have you tried wx.ListBox.EnsureVisible(selectionInt)? This will of
course require getting the index of the item you are selecting.

Yes, I've tried that and it doesn't scroll the listbox.

Which platform?

Thanks for
the suggestion.

There is also SetFirstItem. If that doesn't work either then please enter a bug report about it, specifying the platform for the category.

···

On 1/22/07, Rooney, Mike (ext. 324) <mxr@qvii.com> wrote:

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

I'm using Linux.

Thanks, the SetFirstItem method works.

-Isaac

···

On 1/22/07, Robin Dunn <robin@alldunn.com> wrote:

Isaac Wagner wrote:
> On 1/22/07, Rooney, Mike (ext. 324) <mxr@qvii.com> wrote:
>> Have you tried wx.ListBox.EnsureVisible(selectionInt)? This will of
>> course require getting the index of the item you are selecting.
>>
> Yes, I've tried that and it doesn't scroll the listbox.

Which platform?

> Thanks for
> the suggestion.
>

There is also SetFirstItem. If that doesn't work either then please
enter a bug report about it, specifying the platform for the category.

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

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