Re: Can Delphi TListBox scroll horizontally too?

Posted by Jenny, DelphiLand Team on August 21, 2008

In Reply to Re: Can a TListBox scroll horizontally too? posted by Lee P12462 on August 20, 2008

: Turns out, I didn't understand ScrollWidth.
: I was expecting a similar behavior to when a vertical scroll bar is present. Once it appears, you have access to ALL lines when you scroll up and down.
: With horizontal scrolling, I was thinking that once ScrollWidth was greater than Width then an entire line would be horizontally scrolled within the visible line. This isn't true (or didn't seem to be in my case). Even though Width was 313, I have to make ScrollWidth=1000 in order to be able to scroll to the end of my longest line.

That's right, an horizontal scrollbar on a Delphi ListBox only shows the width in pixels that you assigned to ScrollWidth. It doesn't check the width of your longest line, so you have to calculate or estimate that maximal length yourself.

Related articles