Reseting TScrollBox

Posted on 2005-03-09
Medium Priority
Last Modified: 2010-04-05
How can I reset a TScrollBox position?

I cant do this if I hide the VertScrollBar (Visible := FALSE); Or AutoScroll := FALSE.

ScrollBox1.VertScrollBar.Position := 0; <--- has no effect.

Please help me.


Question by:kapot
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
LVL 15

Accepted Solution

mikelittlewood earned 112 total points
ID: 13498067
If you have VertScrollBar.Visible := FALSE, why would you need to reset it? Surely you cant move down the scrollbox in the first place?
LVL 15

Expert Comment

ID: 13498133
And if you had something in the scrollbox that was bigger than the vertical limit, then surely you need a vertical scrollbar no?
Then ScrollBox1.VertScrollBar.Position := 0 would work.

Author Comment

ID: 13498216
I made my own scrolling function, so I control it manually via code.

I put two TImage as buttons, UP and DOWN.

In the UP button, I call "ScrollBy(0, -5);"

In the Down button, I call "ScrollBy(0, 5);"

Why I do this, because I want to use my own graphic, the default look of scrollbox is ugly.

But, then I can not reset the scrollbox position to its default.

Maybe bug or something?

Try it your self, put 3 TButtons :
Button1 -> ScrollBox1.ScrollBy(0, -5);
Button2 -> ScrollBox1.ScrollBy(0,  5);
Button3 -> Try to reset it

But you need to hide the scrollbar (by setting .Visible := FALSE; or AutoScroll := FALSE);
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 15

Expert Comment

ID: 13498338
I found that if you set the component.top property of the component in the scrollbox ... seems to reset ok
LVL 15

Expert Comment

ID: 13498348
I put an Image component into the scrollbox, then scrolled it off screen all the way
Then called Image1.Top := 0. Put the top part of the image at the top of the scrollbox

Assisted Solution

SIG_BG earned 108 total points
ID: 13500261
You shouldn't use th ScrollBy function with the control -> this only
scrolls the control canvas without udating its information properly.

Use WM_VSCROLL and WM_HSCROLL messages and send them to the control like that:

Control.Perform(WM_VSCROLL, SB_LINEDOWN, 0);

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question