FMX.ControlsDemo Sample
This sample illustrates the FireMonkey Controls and how to use them.
Contents
Location
You can find the Controls Sample sample project at:
- Start | Programs | Embarcadero RAD Studio Athens | Samples and navigate to:
Object Pascal\Multi-Device Samples\User Interface\ControlsDesktop
CPP\Multi-Device Samples\User Interface\ControlsDesktop
- 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.
Description
This sample shows how to use FireMonkey controls.
How to Use the Sample
- Navigate to the location given above, and open the ControlsDemo project file.
- Press F9 or choose Run > Run.
- Open different tabs, observe and try to use FireMonkey controls in each tab.
Classes
FireMonkey Controls represents the main window of the sample. It contains the following components:
- MainMenu with the File and Help MenuItems, each of them containing several other MenuItems
- OpenDialog
- Timer
- TLayout, called ControlRoot, containing the TabControl, called TabControl1, with several TabItems:
- The first TabItem, called Standard, contains the following controls:
- AniIndicator
- Button
- CalloutPanel with four RadioButtons and a Label
- Two CheckBoxes
- Four Labels
- Panel with a Label and two Buttons
- ProgressBar
- Two RadioButtons
- Two ScrollBars
- SmallScrollBar
- ComboBox with several string type ListBoxItems
- ListBox with several string type ListBoxItems
- TEdit, called TextBox1
- TrackBar
- The second TabItem, called Additional, contains the following controls:
- The third TabItem, called ExtControls, contains the following controls:
- The fourth TabItem, called TreeView and ListBox, contains the following controls:
- The fifth TabItem, called Transformations, contains the following controls:
- The sixth TabItem, called ScrollBox, contains the following controls:
- The seventh TabItem, called Memo, contains the Memo control.
- The eighth TabItem, called New!, contains the following controls:
- AlphaTrackBar
- BWTrackBar
- HueTrackBar
- Four CheckBoxes
- TButton, called CornerButton
- ComboColorBox
- ComboEdit
- ComboTrackBar
- Six CornerButtons, two of them containing Paths as children.
- Three Labels
- SpinBox
- ClearingEdit
- TrackBar
- StatusBar, containing the following controls:
- The first TabItem, called Standard, contains the following controls:
Implementation
When you run the application, the main window of the sample is displayed:
- Position the mouse pointer over the TMenuItem object named File, from the TMainMenu object, to display the File menu.
- Select the File > Load Style command to open a browse dialog, where you can load a new
.style
file. The FireMonkey style files are available atC:\Users\Public\Documents\Embarcadero\Studio\23.0\Styles
. - Select the File > Exit command to close the main window of the sample.
- Select the Help > About command to display an animated About box (aboutboxfrm.fmx).
- Select the File > Load Style command to open a browse dialog, where you can load a new
- Select one of the TTabControl objects, to display the specific controls for each of the eight tabs (Standard, Additional, and so forth):
- Standard is TabItem1. This tab shows the standard controls, such as labels, buttons, radio buttons, check box, and edit box.
- Type some text in the TEdit object labeled Edit to change its content.
- Clear or check the TCheckBox object.
- Click the arrow on the TComboBox object labeled ListBoxItem to view its subitems.
- Grab the scroll on the TTrackBar object and move it to the right.
- Check the TCheckBox object, named MultiSelect, to be able to select more than one item from the TListBox object.
- The TProgressBar has its BindingSource property set to
ScrollBar1
, so changing the value of the scroll bar automatically changes the value of the progress bar. - The TCalloutPanel changes the callout position according to the radio button selection.
- Additional is TabItem4. Select the TTabItem object, named Additional, to see some additional controls.
- Select the arrow from the TExpander object to compact and to expand the box.
- Grab the angle point from the TArcDial angle buttons and spin it, to change the value of an angle. This changes the value of the label corresponding to the rotated angle button.
- Use the TCalendar object to view the calendar and select a specific date. The value of the date is changed.
- Ext Controls is TabItem5.
- Drag an item over the TDropTarget object.
- Type some text in the TClearingEdit object, and then press the x button to erase the text you typed.
- TreeView and ListBox is TabItem3. This tab displays the ListBox and TreeView controls that allow you to build a list box or a tree view.
- In the TreeView, click the arrows to expand or to compact the view. The tree view has several tree view items, displayed on three levels.
- The list box displays list box items with different content (labels, images, paths, buttons).
- The check box labeled as Show check boxes shows check boxes before the items in the tree view and in the list box.
- Transformations is TabItem6. This tab displays the Rotate and Opacity controls with which you can transform objects.
- Scroll the Rotate and Opacity TrackBar objects, and observe how the angle and the opacity of other objects are changed. (Opacity must be high in order to see the rotation changes.)
- ScrollBox is TabItem2.
- This tab displays the TVertScrollBox control that you can use to provide a vertical scroll box in your application.
- Also this tab displays the Rectangle with a Label and VertScrollBox. The VertScrollBox contains three Expanders, each of them having a Button, Edit, and TrackBar as children. Expanders provide the possibility to expand or contract their display area showing or hiding contained controls. VertScrollBox supports vertical scrolling of Expanders if they do not fit in the visible area.
- Memo is TabItem8. This tab displays the TMemo control that allows you to keep written notes.
- New! is TabItem7. This tab displays some of the newer FireMonkey controls.
- Set the corner check boxes associated with the first CornerButton, called CornerButton1, to see how they round checked corners of the button. The TrackBar4 track bar's value sets the X and Y radius for all rounded corners of all corner buttons.
- Click the ColorComboBox to display the color wheel from which you can select a color.
- Click the down-arrow on the ComboEdit to display the available choices.
- Click the arrows on the TSpinBox to increment or decrement the number displayed.
- Click the segmented corner button to see how to set the Corners property when creating a segmented corner button.
- Standard is TabItem1. This tab shows the standard controls, such as labels, buttons, radio buttons, check box, and edit box.
- The Switch to 3D and back button, located below the TabControl and thus available on each tab, briefly animates the current tab as a 3D image, using TViewPort3D and TLayer3D.
Uses
- FMX.Menus.TMainMenu
- FMX.Dialogs.TOpenDialog
- FMX.StdCtrls.TStatusBar
- FMX.TabControl.TTabControl
- FMX.StdCtrls.TGroupBox
- FMX.ExtCtrls.TDropTarget
- FMX.StdCtrls.TCalloutPanel
- FMX.StdCtrls.TAniIndicator
- FMX.StdCtrls.TProgressBar
- FMX.StdCtrls.TSmallScrollBar
- FMX.StdCtrls.TTrackBar
- FMX.Layouts.TScrollBox
- FMX.Objects.TRectangle
- FMX.Layouts.TVertScrollBox
- FMX.StdCtrls.TSplitter
- FMX.Calendar.TCalendar
- FMX.DateTimeCtrls.TDateEdit
- FMX.NumberBox.TNumberBox
- FMX.ExtCtrls.TPopupBox
- FMX.Objects.TEllipse
- FMX.Colors.TAlphaTrackBar
- FMX.Colors.TBWTrackBar
- FMX.Colors.TComboColorBox
- FMX.ComboEdit.TComboEdit
- FMX.ComboTrackBar.TComboTrackBar
- FMX.Colors.THueTrackBar
- FMX.SpinBox.TSpinBox
- FMX.Menus.TMenuItem
- FMX.Layouts.TLayout
- FMX.TabControl.TTabItem
- FMX.StdCtrls.TButton
- FMX.ListBox.TListBox
- FMX.ListBox.TListBoxItem
- FMX.StdCtrls.TExpander
- FMX.StdCtrls.TTrackBar
- FMX.StdCtrls.TArcDial
- FMX.StdCtrls.TCheckBox
- FMX.StdCtrls.TRadioButton
- FMX.StdCtrls.TLabel
- FMX.StdCtrls.TScrollBar
- FMX.Edit.TEdit
- FMX.StdCtrls.TPanel
- FMX.TreeView.TTreeView
- FMX.TreeView.TTreeViewItem
- FMX.Memo.TMemo
- FMX.Edit.TClearingEdit
- FMX.StdCtrls.TCornerButton
- FMX.Objects.TPath
See Also
Samples
- FireMonkey Native Controls sample