Board index » delphi » TListBox horizontal scrollbar

TListBox horizontal scrollbar

When number of lines exceeds height of ListBox
the vertical scrollbar appears automatically.

What should I do to show horizontal scrollbar when=20
width of lines exceeds width of ListBox.

Thank you
Roman Broz

--=20
Remove NOSPAM from the address.
Help prevent SPAM mail.

 

Re:TListBox horizontal scrollbar


Quote
Roman Broz wrote:
> What should I do to show horizontal scrollbar when
> width of lines exceeds width of ListBox.

To enable the scroll bar, send a LB_SETHORIZONTALEXTENT message to the
listbox. As fas as I know, this must be done manually, i.e. there is no
way of having the scrollbar appear and disappear automatically depending
on the longest string in the listbox.

--
Andre M. Naef
Naef Consulting

Remove the "delete.this" part from the address when replying by email.

Re:TListBox horizontal scrollbar


Quote
Roman Broz wrote:

> When number of lines exceeds height of ListBox
> the vertical scrollbar appears automatically.

> What should I do to show horizontal scrollbar when
> width of lines exceeds width of ListBox.

If you haven't received an answer yet, I'll show you how to do it.  One
question though, would like like a component which implements it as a
new property (cleaner) are just do it from the unit containing the Form?

Both are equally easy, by the way.

Mark

Re:TListBox horizontal scrollbar


Quote
Roman Broz wrote:

> When number of lines exceeds height of ListBox
> the vertical scrollbar appears automatically.

> What should I do to show horizontal scrollbar when
> width of lines exceeds width of ListBox.

Try make something as this looks:
/* der. from S. ORLICK's book*/

ListBox1 : TListBox;
ScrollWidth : Integer;
...

  ListBox1.Perform(LB_SETHORISONTALEXTENT,ScrollWidth,Longint(0));

ScrollWidth is a  width of the horizontal scrollbar.

Put this call into OnFormCreate or other event handler.

Quote
> Thank you
> Roman Broz

> --
> Remove NOSPAM from the address.
> Help prevent SPAM mail.

Best Regards
Rostislav
________________________________________________________________________
Russian Federation
Saint-Petersburg
LOT Ltd.

Other Threads