【问题标题】:disable automatic changing of keyboard layout in DbGrids.pas in VCL在 VCL 中禁用 DbGrids.pas 中键盘布局的自动更改
【发布时间】:2012-03-18 05:53:46
【问题描述】:

我使用ActivateKeyboardLayout(HKL_NEXT, KLF_ACTIVATE);使用Delphi XE2加载波斯语键盘布局,但有时我点击TextBox或DbGrid控制键盘自动更改为英文布局。

如何禁用自动更改键盘布局?

【问题讨论】:

    标签: delphi delphi-xe2 keyboard-layout


    【解决方案1】:

    我们有同样的问题。从 D2006 升级到 D2010 后出现此错误。

    问题在于 DBGrids.pas:

    procedure TCustomDBGrid.WMKillFocus(var Message: TMessage);
    begin
      ImeName := Screen.DefaultIme;
      ImeMode := imDontCare;
      inherited;
      if not ((InplaceEditor <> nil) and
        (HWND(Message.WParam) = InplaceEditor.Handle)) then
        ActivateKeyboardLayout(Screen.DefaultKbLayout, KLF_ACTIVATE);
    end;
    

    我不知道为什么 Borland/Embarcadero 在继承后添加了“if block”。更改会导致将键盘布局切换回默认值。我们必须将 DBGrids 复制到我们的项目中并删除“if block”。

    【讨论】:

      猜你喜欢
      • 2018-02-01
      • 2012-12-20
      • 1970-01-01
      • 1970-01-01
      • 2014-12-14
      • 1970-01-01
      • 2016-08-06
      • 1970-01-01
      相关资源
      最近更新 更多