You can find the Sensors sample project at:
- Start | Programs | Embarcadero RAD Studio Rio | Samples and then navigate to:
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
How to Use the Sample
- Navigate to one of the locations given above and open:
- Press F9 or choose Run > Run.
|File in Delphi||File in C++||Contains|
The project itself.
The main form.
TForm5 is the main form that represents the main window of the sample. It contains the following components:
- A TGroupBox object, named GroupBox4, that contains:
- A TButton object named bSwitch.
- A TLocationSensor object named lsLocation.
- A TMotionSensor object named msAccelerometer.
- Two TOrientationSensor objects, named osCompass and osInclinometer.
- A TPanel object, named Panel1, that contains tree TGroupBox objects.
- Two TTimer objects, named tMotion and tOrientation.
- The sample uses TLocationSensor to determine the location information of the device.
- The sample uses TMotionSensor to offer information about the acceleration in each coordinate axis.
- The sample uses TOrientationSensor to give information about the device inclination and compass heading.
- The sample uses TButton to enable the VCL sensors.
- The sample uses TTimer to repeat specific actions after a given time interval. Each TTimer specifies the time interval in which each sensor offers information to the user.
- The sample uses TLabel to display text on the form. Each label is used to display each sensor information.
- The sample uses TGroupBox to group related controls on a form. In this sample, each TGroupBox groups the labels that display information about the sample sensor.
When you run the application, the Active properties of the VCL sensors are set to
False, which means that all the sensors are disabled. Moreover, you see the form divided in four TGroupBox objects with the following captions:
Manage. The GroupBox4, labeled as
Manage, contains the bSwitch button with its caption displaying the text
Turn on. When you click on the bSwitch button, its caption changes to
Turn off and the Active property of the VCL sensors changes to
True. Then, the information related with each sensor is displayed using the labels that contain each TGroupBox object.