Board index » delphi » ListBox question

ListBox question

I have a question:

Is it possible to scroll up the contents of a ListBox when i use
ListBox.items.Add so that I don't have to use the scrollbar to scroll down
with my mouse when the data doesn't fit in the ListBox ?
When i use ListBox.Items.Add the new data should appear on the bottom line
of the ListBox, the rest of the text
must scroll up.

please also send a copy of your answer to my email-address.

Thanks!

Erwin.

* Please remove REMOVETHIS from my email-address *

 

Re:ListBox question


Quote
"Erwin Konings" <nl1rsdREMOVET...@worldonline.nl> writes:
>I have a question:

>Is it possible to scroll up the contents of a ListBox when i use
>ListBox.items.Add so that I don't have to use the scrollbar to scroll down
>with my mouse when the data doesn't fit in the ListBox ?
>When i use ListBox.Items.Add the new data should appear on the bottom line
>of the ListBox, the rest of the text
>must scroll up.

LB.Items.Add('whatever');
LB.ItemIndex := LB.Items.Count - 1; {the last line is selected now}

You can do fancier stuff if you use LB.TopIndex, e.g.

LB.Items.Add('whatever');
I := LB.ItemIndex;
LB.ItemIndex := LB.Items.Count - 1;
if I < LB.TopIndex then
   LB.ItemIndex := LB.TopIndex;

Thomas Nagy
-----------------------------------------------------------
Check out my cats! (http://members.tor.shaw.wave.ca/~tnagy/)

Other Threads