FMX.KeyboardTypes Sample
This is a sample that shows key entry types in mobile applications, using FireMonkey.
Contents
Location
You can find the KeyboardTypes sample project at:
- Start | Programs | Embarcadero RAD Studio Athens | Samples and navigate to:
Object Pascal\Multi-Device Samples\User Interface\KeyboardTypes
CPP\Multi-Device Samples\User Interface\KeyboardTypes
- Subversion Repository:
Description
This application shows how to use different types of Virtual Keyboard.
How to Use the Sample
- Navigate to the one of the locations given above, and open:
- Delphi: VirtualKeyboardDemo.dproj
- C++: VirtualKeyboardDemo.cbproj
- Press F9 or choose Run > Run.
- Observe that different Virtual Keyboard types (Alphabet, NumberPad, EmailAddress, PhonePad, URL, and others) activate when you place input focus into different edit controls: First Name, Email, Phone, and others.
Classes
TVKBaseForm, named VKBaseForm
, is the main window of the
KeyboardTypes sample. It contains the VertScrollBox1
vertical scrolling area containing the MainLayout1
layout. MainLayout1
contains the following components:
ListBox1
list box with multiple list box items containing different TEdit edit controls:ListBoxItem1
contains the First Name edit control (Edit1
).ListBoxItem2
contains the Last Name edit control (Edit2
).ListBoxItem3
contains the City edit control (Edit3
).ListBoxItem4
contains the State edit control (Edit4
).ListBoxItem5
contains the Zip Code edit control (Edit5
).ListBoxItem6
contains the Email edit control (Edit6
).ListBoxItem7
contains the Phone edit control (Edit7
).ListBoxItem8
contains the Web Page edit control (Edit8
).
ToolBar1
tool bar containing the Keyboard Types labelLabel1
.
Implementation
- The virtual keyboard type (Alphabet, NumberPad, and others) is stored in the KeyboardType property of edit controls. To change the virtual keyboard type, select an edit control (First Name, Email or other) in the Form Designer and select an needed virtual keyboard type in the KeyboardType property in the Object Inspector.
- The event handlers for OnVirtualKeyboardShown and OnVirtualKeyboardHidden events of the VKBaseForm object are used to scroll the VertScrollBox1 scroll box and adapt the view to the height of the Virtual Keyboard.
Uses
- FMX.VirtualKeyboard.IFMXVirtualKeyboardToolbarService.SetHideKeyboardButtonVisible
- FMX.VirtualKeyboard.IFMXVirtualKeyboardToolbarService.SetToolbarEnabled
- FMX.Edit.TCustomEdit.KeyboardType