如何让TWebBrowser忽略其他控件的加速符?

发布于 2024-08-28 12:38:26 字数 208 浏览 4 评论 0原文

我在启用了设计模式的表单上放置了一个 TWebBrowser。
在浏览器下方,我有一个关闭按钮,其标题设置为“Clos&e”。
当我在 Web 浏览器中编辑文档内容并按下 E 键时,将调用关闭按钮。
看起来它像其他不处理键和/或不接受字符的控件(例如 TButton)一样对待 TWebBrowser。

我该如何解决这个问题?

提前致谢。

I have a TWebBrowser placed on a form with the designMode enabled.
Bellow the browser I have a close button with the Caption set to 'Clos&e'.
When I am editing the contents of a document inside the WebBrowser and I press the key E the button close is called.
It appears that it is treating TWebBrowser like other controls that don't handle keys and/or don't accept chars (e.g. TButton).

How can I solve this?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒解孤独 2024-09-04 12:38:28

从 TWebBrowser 下降,覆盖 CN_CHAR 消息处理程序,并返回 0。使用 Alt+E 触发快捷方式仍然有效。

type
  TWebBrowser = class(SHDocVw.TWebBrowser)
    procedure CNChar(var Message: TWMChar); message CN_CHAR;
  end;

...

procedure TWebBrowser.CNChar(var Message: TWMChar);
begin
  Message.Result := 0;
end;

Descend from TWebBrowser, override the CN_CHAR message handler, and return 0. Triggering the shortcut with Alt+E will still work.

type
  TWebBrowser = class(SHDocVw.TWebBrowser)
    procedure CNChar(var Message: TWMChar); message CN_CHAR;
  end;

...

procedure TWebBrowser.CNChar(var Message: TWMChar);
begin
  Message.Result := 0;
end;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文