ActiveX control does not handle arrows correctly when placed in a Delphi application

I have an ActiveX control hosted in our application. The control was imported using the Delphi import component menu.

The ActiveX control contains an input field for user input. When I run the control in my own sandbox application (and not in the Delphi application), the arrow keys work as expected by moving the cursor inside the edit control.
However, when I launch the Delphi application, the behavior of the arrow key seems to change. It looks like this is more like a tab.

I guess this is due to the way VCL handles key strokes. Any ideas how to get around this?

+3
source share
1 answer

The control must process WM_GETDLGCODEand include at least the result DLGC_WANTARROWS.

In addition, if the ActiveX control is written in Delphi and uses it csReflectorin its own way ControlStyle, it must be rebuilt using WM_KEYDOWNand WM_KEYUP(and any other necessary) message handlers added to the VCL control TReflectorWindowin the module AxCtrlsfor delegating messages:

procedure TReflectorWindow.WMKeyDown(var Message: TMessage);
begin
  Message.Result := FControl.Perform(Message.Msg, Message.WParam, Message.LParam);
end;

procedure TReflectorWindow.WMKeyUp(var Message: TMessage);
begin
  Message.Result := FControl.Perform(Message.Msg, Message.WParam, Message.LParam);
end;

This seems sufficient to work in my tests using the D2007.

0
source

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


All Articles