This sample illustrates how to create a custom control in FireMonkey.
You can find the customcontrol sample project at:
- Start | Programs | Appmethod 1.15 | Samples and then navigate to Object Pascal\FireMonkey Desktop\customcontrol
- Subversion Repository for Object Pascal: http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RadStudio_XE7//Object%20Pascal/FireMonkey%20Desktop/customcontrol/
This application creates a customized visual control. The result is a circle with a different style depending on the operating system.
How to Use the Sample
- Navigate to the location given above, and open customcontrol.dproj.
- Press F9 or choose Run > Run.
Form6 represents the main window of the sample. No controls are placed on the form at design time. The customized control is created in the form's OnCreate event, using the TMyControl class, derived from TStyledControl.
- customcontrolfrm.pas is the main source file.
- fmx.customcontrol.pas contains the implementation of TMyControl. This file is added to the project's uses list.
- The fmx.customcontrol.win.style and fmx.customcontrol.mac.style files define the different styles for the control, according to the platform the application runs on.