00 Votes

Delphi/Lazarus: How to scroll already when moving the scrollbar

Question by Guest | 2018-03-02 at 11:26

While moving the slider of a scrollbar, the content remains unchanged by default - for example, at the scrollbox control. Only when you release the slider, the content of the box is moved to the right place.

Unfortunately, with this behavior, the user of my program does not know how far to move the slider. Is there any possibility that the shift takes place while moving the slider?

0Best Answer0 Votes

There is the property Tracking available at a scrollbar to change this behavior. By default, tracking is set to false, which causes your behavior as described. If you set tracking to true, scrolling will be done when moving the slider.

ScrollBox1.VertScrollBar.Tracking := true;
ScrollBox1.HorzScrollBar.Tracking := true;  

In the case of a TScrollBox, you can set the tracking property through the Object Inspector or in your code as shown above. As a rule, every control with a scrollbar should have this property.
2018-03-03 at 09:54

ReplyPositive Negative
00 Votes

Hi, if you want to set the Tracking to true as mentioned above, do you need to do it between the Begin/End captions or under the procedure?
2020-06-30 at 12:05

Positive Negative
00 Votes

Statements like that are always written between begin and end. What do you mean with under the procedure?

The best is, just set it within the Object Inspector after clicking on the control. So, you do not have to write any code. If you want to do it in code, the best place would be the OnCreate procedure of your Form.
2020-06-30 at 15:03

Positive Negative

Related Topics

Scrollbar in DIV container

Question | 1 Answer

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.