FMX.KeyboardToolbar Sample
This is a sample that shows the use of a popup keyboard in mobile applications using FireMonkey.
- Note: This sample application only works on iOS. It does not work on Android.
Contents
Location
You can find the FireMonkeyMobile KeyboardToolbar sample project at:
- Start | Programs | Embarcadero RAD Studio Athens | Samples and navigate to:
Object Pascal\Multi-Device Samples\User Interface\KeyboardToolbar
CPP\Multi-Device Samples\User Interface\KeyboardToolbar
- 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 application illustrates how to customize the toolbar associated to the virtual keyboard using the IFMXVirtualKeyboardToolbarService.
How to Use the Sample
- Navigate to the one of the locations given above, and open:
- Delphi: KeyboardToolbar.dproj
- C++: KeyboardToolbar.cbproj
- Press F9 or choose Run > Run.
- To observe the functionality of the Keyboard Toolbar, follow the following steps:
- To invoke the virtual keyboard, use the TEdit control (named
Edit1
). - To enable or disable the Keyboard Toolbar, switch the TSwitch control (named
swToolbar
) On or Off. - To add a TVirtualKeyboardToolButton button to the Keyboard Toolbar, use the Add button (named
btnAdd
). Notice that the button is visible in the Keyboard Toolbar (displayed over the virtual keyboard) and in the TListBox list box (lbButtons
). - To remove a TVirtualKeyboardToolButton button from the Keyboard Toolbar, select the button from the TListBox (
lbButtons
) and press the Delete button (namedbtnDelete
).
- To invoke the virtual keyboard, use the TEdit control (named
Classes
TForm1 (named Form1
) is the main window of the KeyboardToolbar sample. It contains the following components:
- TToolBar named
ToolBar1
- Two TButton buttons named
btnAdd
andbtnDelete
- Two TButton buttons named
- TListBox named
lbButtons
that is intended to contain keyboard toolbar buttons created with thebtnAdd
button.- TListBoxGroupHeader named ListBoxGroupHeader3. It shows the CUSTOM BUTTONS caption.
- TListBox named
ListBox1
contains:- TListBoxGroupHeader named
ListBoxGroupHeader1
. It shows the TOOLBAR caption. - TListBoxGroupHeader named
ListBoxGroupHeader2
. It shows the SAMPLE CONTROLS caption. - TListBoxHeader named
ListBoxHeader2
. It contains the TLabel label control namedLabel2
showing Keyboard ToolBar caption. - TListBoxItem named
ListBoxItem1
. It contains the TSwitch control namedswToolbar
. - TListBoxItem named
ListBoxItem2
. It contains the TSwitch control namedswDoneButton
. - TListBoxItem named
ListBoxItem3
. It contains three controls:
- TListBoxGroupHeader named
Implementation
- To enable or disable the Keyboard Toolbar, the SetToolbarEnabled method is used.
- To add or delete buttons from the Keyboard Toolbar, the AddButton and DeleteButton methods are used.
Uses
- IFMXVirtualKeyboardToolbarService.AddButton
- IFMXVirtualKeyboardToolbarService.DeleteButton
- IFMXVirtualKeyboardToolbarService.IsHideKeyboardButtonVisible
- IFMXVirtualKeyboardToolbarService.SetHideKeyboardButtonVisibility
- IFMXVirtualKeyboardToolbarService.SetToolbarEnabled