如何实现 - 在Windows 10桌面上的TPanel Delphi Seattle 10中的FMX TVirtualkeyboard

时间:2015-12-17 15:16:46

标签: keyboard firemonkey delphi-xe

AControl是TPanel

procedure TDialogAccess.CheckVirtualKeyboard(const AControl: TFmxObject; Edit: TEdit); begin if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService) then begin if not assigned(ikeyboard) then ikeyboard := TPlatformServices.Current.GetPlatformService(IFMXVirtualKeyboardService) as IFMXVirtualKeyboardService; if assigned(ikeyboard) then begin if not (TVirtualKeyboardState.Visible in ikeyboard.VirtualKeyboardState) then begin ikeyboard.ShowVirtualKeyboard(AControl); Edit.SetFocus; end; end; end; end;

TVirtualkeyboard显示在一个单独的窗口中,如何将其作为Panel的Child? 您必须单击编辑控件,TVirtualkeyboard会实现输入的目标,如何以编程方式执行此操作?

1 个答案:

答案 0 :(得分:0)

不能为Panel假装像子组件一样。但是,如果在单击任何输入字段时需要键盘,则可以在面板的子面板上创建键盘。你可以这样做:

procedure TForm1.Edit1Click(Sender: TObject);
begin
  keyboardPanel.Visible := True;

  //.. Your codes here

end;

你的结构必须是这样的:

Form1
 Panel1
  KeyboardPanel
   KeyboardInputsButtons