Delphi XE5 for Android (九)
Delphi XE5 下TEdit控件有个属性:KeyboardType,如下图:
该属性决定了当焦点进入TEdit时,系统弹出的输入窗体,按照其帮助文件说明,不同取值的输入窗体不同,如下图:
根据不同需要选择,也可以在运行期改变取值,通过放置一个TPopupBox控件来进行设置,设计界面如下:
代码如下:
procedure TfrmKeyboard.PopupBox1Change(Sender: TObject); begin case PopupBox1.ItemIndex of 0: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktDefault; 1: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktNumbersAndPunctuation; 2: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktNumberPad; 3: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktPhonePad; 4: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktAlphabet; 5: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktURL; 6: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktNamePhonePad; 7: Edit1.KeyboardType := FMX.Types.TVirtualKeyboardType.vktEmailAddress; end; end;