FMX.HorizontalScroll Sample
This sample demonstrates how to use the THorzScrollBox component in order to scroll through different pictures on your FireMonkey form.
Contents
Location
You can find the HorizontalScroll sample project at:
- Start | Programs | Embarcadero RAD Studio Berlin | Samples and then navigate to:
Object Pascal\Mobile Snippets\HorizontalScroll
CPP\Mobile Snippets\HorizontalScroll
- Subversion Repository:
Description
The HorizontalScroll sample shows how to use THorzScrollBox to scroll through different pictures on your iOS or Android device. The sample uses a THorzScrollBox component with four images that the user can move horizontally.
How to Use the Sample
- Navigate to one of the locations given above and open:
- Delphi: HorizontalScroll.dproj.
- C++: HorizontalScroll.cbproj.
- Select the target platform, iOS and Android supported.
- Press F9 or choose Run > Run.
- Interact with the sample. Sweep your finger through the images in order to scroll through the images.
Files
File in Delphi | File in C++ | Contains |
---|---|---|
HorizontalScroll.dproj |
HorizontalScroll.cbproj |
The project itself. |
uMain.fmx |
uMain.fmx |
The main form where the components are located. |
uMain.pas |
HorizontalScrollPCH.h, HorizontalScroll.cpp |
Used to define and implement the sample. |
Information.txt |
Information.txt |
Further information about the sample. |
Classes
THorizontalScrollForm is the main form that represents the main window of the sample. It contains the following components:
- A THorzScrollBox object with four TImage objects.
- A TToolBar object with a TLabel object.
Implementation
- The sample uses THorzScrollBox to create a scroll box in a FireMonkey form restricted to horizontal scrolling.
- The sample uses TImage to display and define 2D image components.
When you run the aplication, the sample uses THorzScrollBox to show a scroll box in your FireMonkey form with an image attached to each TImage component. The align property of the THorzScrollBox component is set to client so that the horizontal scroll box fills the entire FireMonkey form except the Tool Bar at the bottom. Therefore, if you slide your finger horizontally anywhere on the FireMonkey form, the images move horizontally.
Uses
See Also
Samples
- FireMonkey Platform Scroll Box sample
- FireMonkey Scrollable Form sample