开发者

How do I make my custom treeview accept the Enter key?

I've got a custom control that desce开发者_JAVA技巧nds 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?


I always do

WM_GETDLGCODE: Message.Result := Message.Result or DLGC_WANTCHARS or
                                 DLGC_WANTARROWS or DLGC_WANTTAB or
                                 DLGC_WANTALLKEYS;

when writing text editors. Maybe you just forgot DLGC_WANTARROWS?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜