VCL.Arrow Managed Keys and Tab Key

I use Managed VCL to host my .net User control in a Delphi form. But I have a problem: the tab key, arrow keys and special keys (HOME, INSERT) do not work.

I tried everything that was written on the Managed VCL forum.
1) I tried to set my user control to a higher level user element and override ProcessDialogKey. But it did not help.
2) I tried adding DLGC_WANTTAB or DLGC_WANTALLKEYS to Message Result of TClrCustomControl.WMGetDlgCode, but that also did not help me.

Can someone help me with this problem?

+4
source share
1 answer

I had a similar problem. I solved this by intercepting the tab key in the host form and not allowing it to handle the keystroke. The following code worked in my case:

procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY; ... procedure TForm1.CMDialogKey(var Message: TCMDialogKey); begin if Message.CharCode = VK_TAB then // ignore tabs and allow the TClrControl to handle them else inherited; end; 

In my case, TClrControl aligns with the client and spans the entire form, so this may not be entirely correct in your situation if you mix VCL and .NET controls.

0
source

Source: https://habr.com/ru/post/1413112/


All Articles