FMX.Mobile.Forms Sample (Object Pascal)
This is a project that shows how to display different forms depending on the orientation, portrait or landscape, of the device running your application.
You can find the Forms Sample project at:
- Start | Programs | Appmethod | Samples and then navigate to Object Pascal\Samples\User Interface\Forms
- Subversion Repository: http://sourceforge.net/p/Appmethod/code/HEAD/tree/branches/Appmethod_113/Object%20Pascal/Samples/User%20Interface/Forms
When you run the application, it shows a form with a background image and a label which states the current orientation of the device, either "Portrait" or "Landscape". When you change the orientation of your device, the form changes to display a different background image and updates the label to mach the new device orientation.
How to Use the Sample
- Navigate to the location given above and open Forms.dproj.
- Press F9 or choose Run > Run.
This application is composed of two forms, each one intended to be displayed when the target mobile device is in a specific orientation.
To show the right form for each orientation, this application handles the OnResize event of each form. The application uses these event handlers to show the right form depending on the Height and Width properties of the form: If Height is lower than Width, then it shows the landscape form, otherwise it shows the portrait form.