This sample illustrates how to use FireMonkey actions. It demonstrates how to use the Action List editor to create action lists and to assign client controls to actions.
You can find the ActionsDemo sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and navigate to:
Object Pascal\Multi-Device Samples\User Interface\ActionsDemo
- Subversion Repository:
- You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
This sample uses FMX action lists to show how FMX actions can be used on FMX forms.
How to Use the Sample
- Open the ActionsDemo.dproj sample project from the location given above.
- Press F9 or choose Run > Run. The Demo actions in FireMonkey application opens.
- In this application, select View > PanelValueRange and View > Display Active Form and Focused Control.
- In the PanelValueRange pane, move sliders and test other controls. The Display Active Form and Focused Control form shows names of controls selected in the PanelValueRange pane.
- Try to activate actions associated to menu commands.
- Try to activate the virtual keyboard using the context menu.
- From the Project Manager, open the UMainForm.pas file. The main form opens.
- In the Structure view, select PanelValueRange.
- In the Object Inspector, locate the Visible property and set it
True. The controls placed in the PanelValueRange panel become visible.
- On the right side of the MainForm form you see the MainMenu1 and PopupMenu1 menus and the FMXActionList1 action list objects.
- Double-click FMXActionList1; the Action List editor opens. Check which standard actions are in the list. Select an action and view its properties in the Object Inspector.
- Double-click MainMenu1; Items Designer opens. Select a menu command and view its properties in the Object Inspector. Locate the Action property and check which FMX action is assigned to the menu command.
- In the Form Designer, in the PanelValueRange panel select a control having the Value property. In the Object Inspector, locate the Action property of the selected control; check that it is associated with the
ValueRangeAction1FMX action. Select the Value property of the selected control and change its value. You see that values of all controls associated with this
ValueRangeAction1action have changed.
- Expand the Action property of the selected control and view the properties of the action in the Object Inspector. At the bottom of the list of the action properties, locate the Value property of the action and change its value. Check that the value of the Value property of the control has changed accordingly. If these two Value properties have different values, then only the value highlighted with bold is stored in the .FMX file.