Delphi XE5 下TEdit控件有個(gè)屬性:KeyboardType,如下圖: 該屬性決定了當(dāng)焦點(diǎn)進(jìn)入TEdit時(shí),系統(tǒng)彈出的輸入窗體,按照其幫助文件說(shuō)明,不同取值的輸入窗體不同,如下圖: 根據(jù)不同需要選擇,也可以在運(yùn)行期改變?nèi)≈?,通過(guò)放置一個(gè)TPopupBox控件來(lái)進(jìn)行設(shè)置,設(shè)計(jì)界面如下: 代碼如下: 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;
|