VCL.Scrollbar Sample
From RAD Studio Code Examples
Language:
This sample demonstrates how to use the TScrollBar component.
Contents |
Location
You can find the scrollbar sample project at:
- Start > Programs > Embarcadero RAD Studio > Samples and then navigate to CPP\VCL\Scrollbar
- Subversion Repository for C++: http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RadStudio_XE4/CPP/VCL/Scrollbar/
Description
The application creates a form with a scroll bar, edits, and a button. The edits indicate the current, minimum, and maximum position of the thumb tab and also the steps used to move it on the scroll bar. The Apply button updates the scroll bar according to the parameters in the edits.
How to Use the Sample
- Navigate to Start > Programs > Embarcadero RAD Studio > Samples and open scrollba.cbproj.
- Press F9 or choose Run > Run.
Files
The project contains one source file, main.pas, which contains the main form class.
Classes
TFormMain, the class corresponding to the main form, handles the events that occur when interacting with the visual components on the form.
Implementation
- TScrollCode is used to determine what action the user performed on the scroll bar. Depending on that, a label on the form is updated.
- Conversion routines _wtoi and itoa are used to convert integers to strings and vice-versa.
- The values from the edits set the following properties: TScrollBar.Position, TScrollBar.Max, TScrollBar.Min, TScrollBar.LargeChange, and TScrollBar.SmallChange.