如何让我的自定义树视图接受 Enter 键?
我有一个源自 TTreeView 的自定义控件。当用户在控件聚焦时按 ENTER 时,我试图通过给它一个响应 VK_RETURN 的 WM_CHAR 处理程序来赋予它特殊的行为,但它永远不会被调用。
我尝试通过添加一个 WM_GETDLGCODE 处理程序来确保它接受所有键盘输入,该处理程序显示 msg.Result := msg.Result 或 DLGC_WANTALLKEYS;
。现在它收到 ENTER 键,但箭头键不再起作用!
有人知道我如何正确解决这个问题吗?
I've got a custom control that descends from TTreeView. I'm trying to give it special behavior when the user presses ENTER while the control is focused, by giving it a WM_CHAR handler that responds to VK_RETURN, but it never gets called.
I tried making sure that it would accept all keyboard input by adding a WM_GETDLGCODE handler that says msg.Result := msg.Result or DLGC_WANTALLKEYS;
. Now it receives the ENTER key, but the arrow keys no longer work!
Anyone have any idea how I can fix this correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我
在编写文本编辑器时总是这样做。也许您只是忘记了
DLGC_WANTARROWS
?I always do
when writing text editors. Maybe you just forgot
DLGC_WANTARROWS
?