00 Votes

Delphi/Lazarus: Show only one Scrollbar in Scrollbox

Question by Guest | 2015-11-16 at 13:28

I am using a Scrollbox in one of my applications, in order to show some controls for which my form would be too small otherwise.

Up to now, the Scrollbox worked quite well, but now I have added a Label with WordWrap = true onto the box, which text should break automatically. Unfortunately, the text does not break to the next line and instead, the horizontal scrollbar is displayed in the Scrollbox so that it is possible to scroll right to see the full text now. Of course, I do not want to have this behavior, it warned that the text wraps and that you can only scroll the box vertically from top to down.

In other words, I only want to show one thing to scrollbar (in my case the vertical scrollbar). How to disable the of the (horizontal) scrollbar?

0Best Answer0 Votes

The scrollbars are offering the property Visible. If you set this property of one of the scrollbars to FALSE, only the other scrollbar will be displayed.

Scrollbox1.HorzScrollBar.Visible := false; 

Here, we are setting the horizontal scrollbar to false, so that only the vertical scrollbar will be visible.

Of course, you can also adjust this setting within the Object Inspector.
2015-11-16 at 16:51

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.