22 Votes

Delphi/Lazarus: Show only one Scrollbar in Scrollbox

Question by Guest | Last update on 2023-02-22 | Created on 2015-11-16

I am using a Scrollbox (TScrollBox) 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 (TLabel) 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 you have to scroll right to see the full text now. Of course, I do not want to have this behavior, it want 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 scrollbar (in my case the vertical scrollbar). How to disable the other (horizontal) scrollbar?

ReplyPositiveNegative
1Best Answer3 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.
Last update on 2023-02-22 | Created on 2015-11-16

ReplyPositive Negative
Reply

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.

Participate

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