Why won't my control accept keyboard input?

后端 未结 5 1117
梦谈多话
梦谈多话 2021-01-18 23:09

I\'ve built a custom control that I\'m trying to send input to. It will accept mouse input and report MouseDown, MouseMove and MouseUp correctly, but for whatever reason, i

5条回答
  •  一整个雨季
    2021-01-18 23:52

    A few things to try:

    • On MouseDown, call Windows.SetFocus(Handle). In my experience, the WinAPI function SetFocus often works better than the VCL's SetFocus method.
    • In response to the WM_GETDLGCODE message, reply with Message.Result := Message.Result or DLGC_WANTCHARS or DLGC_WANTARROWS or DLGC_WANTTAB or DLGC_WANTALLKEYS;

提交回复
热议问题