2

I have a descendant of TCustomControl and want to process Tab key when user press it. But when I press Tab key the focused control on the form just changed. And OnKeyDown and OnKeyPress events didn't fire. How to solve the problem?

Dmitry
  • 13,126
  • 20
  • 95
  • 177
  • Handle the `CM_DIALOGKEY` message. Look for instance at [`this question`](http://stackoverflow.com/q/10470053/960757). – TLama Jul 04 '13 at 16:54
  • But we should use CM_DIALOGKEY message on TForm. May fix the issue on component (descendant of TCustomControl) level? – Dmitry Jul 04 '13 at 17:00

1 Answers1

2

Have the component handle the WM_GETDLGCODE message so it can return the DLGC_WANTTAB flag. See the answer to this question for an example.

Community
  • 1
  • 1
Remy Lebeau
  • 454,445
  • 28
  • 366
  • 620