PDA

View Full Version : Listbox Autoscroll is not happening?



mahe2310
9th March 2006, 07:41
My window carries a listbox where all the actions are defined by myself rather than the
default listbox operations... I am able to move across the elements of the listbox but
not able to scroll the listbox automatically when the selection is out of display range.

I am attaching two images that can help understand the situation.

mahe2310

sunil.thaha
9th March 2006, 07:46
use


QListbox::ensureCurrentVisible();

mahe2310
9th March 2006, 07:59
use


QListbox::ensureCurrentVisible();



hi,

Thanks...

i got the result by using ensureCurrentVisible() function.

But notice... call the function ensureCurrentVisible() immediately after setCurrentItem(i) function.
Otherwise it may not work...

mahe2310

sunil.thaha
9th March 2006, 08:13
But notice... call the function ensureCurrentVisible() immediately after setCurrentItem(i) function.
mahe2310

Could you please make it clear ?

AFAIK it can be called at any time to make the current Item Visible

mahe2310
9th March 2006, 10:13
i called ensureCurrentVisible() at the end of all the loops in my function.
Even if the control reached there, i couldnt make see the results.

So i called it immediately after the setCurrentItem(i) function. It worked.

At first i called the function after all the steps is bcos i am calling the funtion setCurrentItem(i)
at different sub loops and hence avoid repeatd call.


mahe2310