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 Florence | Samples and navigate to:
Object Pascal\Multi-Device Samples\User Interface\KeyboardTypesCPP\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:
ListBox1list box with multiple list box items containing different TEdit edit controls:ListBoxItem1contains the First Name edit control (Edit1).ListBoxItem2contains the Last Name edit control (Edit2).ListBoxItem3contains the City edit control (Edit3).ListBoxItem4contains the State edit control (Edit4).ListBoxItem5contains the Zip Code edit control (Edit5).ListBoxItem6contains the Email edit control (Edit6).ListBoxItem7contains the Phone edit control (Edit7).ListBoxItem8contains the Web Page edit control (Edit8).
ToolBar1tool 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