Page 1 of 1

ListBox ensureItemIsVisible not behaving as expected

Posted: Mon Nov 10, 2008 07:10
by EvilClown
Hi

I have a long list of animation keyframes in a listbox. As the animation plays through, each successive keyframe is selected and i want the selected keyframe to be visible in the list.

I'm using ensureItemIsVisible except there is still a problem. This method seems to put the selected item always at the bottom of the list. This can be a problem if, say, the selected item is already visible and/or the user tries to scroll down the list while playing.

That is, if the item is already visible then i don't want the list to scroll (which it does). The list should move only if the item is not already shown.

Posted: Mon Nov 10, 2008 10:13
by CrazyEddie
Hi,

Yes I agree - if the object is already visible no change in scroll position should occur. This is a bug :)

CE.

Posted: Sun Nov 16, 2008 12:40
by CrazyEddie
I was unable to reproduce this issue.

I had a listbox with 10 items, selected items programatically and also called Listbox::ensureItemIsVisible on those items and the behaviour was correct; the list only scrolled as needed to ensure the item was fully displayed.

It would appear that you do in fact have a usage issue (perhaps I should not have assumed a CEGUI bug so quickly!). One way that the list would always scroll to the bottom would be if you used the Listbox::ensureItemIsVisible(size_t item_index) overload with an invalid index value - so that might be worth checking.

If it's not an invalid index value causing the issue, then if you could post some relevant code, hopefully someone will be able to help further.

CE.

PS. Mantis ticket for the bug report is here: http://www.cegui.org.uk/mantis/view.php?id=246 in case we need to re-open ;)