22 Votes

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

Question by Guest | Last update on 2023-12-18 | Created on 2018-03-02

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?

ReplyPositiveNegativeDateVotes
2Best Answer2 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 instead, scrolling will be already done while 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.
Last update on 2023-12-18 | Created on 2018-03-03

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
Reply
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.