禁用在VCL中的DbGrids.pas中自动更改键盘布局 [英] disable automatic changing of keyboard layout in DbGrids.pas in VCL

查看:140
本文介绍了禁用在VCL中的DbGrids.pas中自动更改键盘布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I use ActivateKeyboardLayout(HKL_NEXT, KLF_ACTIVATE); to load Persian keyboard layout using Delphi XE2, But sometimes I click on TextBox or DbGrid control the keyboard automatically is changed to English layout.

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

How can I disable automatic changing of keyboard layout?

推荐答案

我们有同样的问题。这个bug从D2006升级到D2010后出现。

We have same issues. This bug appeared after upgrade from D2006 to D2010.

问题在DBGrids.pas中:

Issue is in 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。

I have no idea why Borland/Embarcadero added "if block" after inherited. Change causes switching keyboard layout back to default. We had to copy DBGrids to our projects and remove "if block".

这篇关于禁用在VCL中的DbGrids.pas中自动更改键盘布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆