Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the message handling capability of a VCL control and send the relevant messages to one another. I don't know about a 'TcxTreeList', but the following demonstrates the idea on an edit control and a memo control responding to keyboard events synchronously (whereever possible of course).</p> <pre><code>type TEdit = class(stdctrls.TEdit) private FMsgCtrl: TWinControl; FRecursing: Boolean; procedure WmChar(var Msg: TWMChar); message WM_CHAR; procedure WmKeyDown(var Msg: TWMKeyDown); message WM_KEYDOWN; procedure WmKeyUp(var Msg: TWMKeyUp); message WM_KEYUP; end; TMemo = class(stdctrls.TMemo) private FMsgCtrl: TWinControl; FRecursing: Boolean; procedure WmChar(var Msg: TWMChar); message WM_CHAR; procedure WmKeyDown(var Msg: TWMKeyDown); message WM_KEYDOWN; procedure WmKeyUp(var Msg: TWMKeyUp); message WM_KEYUP; end; TForm1 = class(TForm) Edit1: TEdit; Memo1: TMemo; procedure FormCreate(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.dfm} { TEdit } procedure TEdit.WmChar(var Msg: TWMChar); begin if not FRecursing then begin inherited; // Insert test here to see if the message will be forwarded // exit/modify accordingly. if Assigned(FMsgCtrl) then begin FRecursing := True; try FMsgCtrl.Perform(Msg.Msg, MakeWParam(Msg.CharCode, Msg.Unused), Msg.KeyData); finally FRecursing := False; end; end; end; end; procedure TEdit.WmKeyDown(var Msg: TWMKeyDown); begin // exact same contents as in the above procedure end; procedure TEdit.WmKeyUp(var Msg: TWMKeyUp); begin // same here end; { TMemo } procedure TMemo.WmChar(var Msg: TWMChar); begin // same here end; procedure TMemo.WmKeyDown(var Msg: TWMKeyDown); begin // same here end; procedure TMemo.WmKeyUp(var Msg: TWMKeyUp); begin // same here end; { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin Edit1.FMsgCtrl := Memo1; Memo1.FMsgCtrl := Edit1; end; </code></pre> <p>You might need to intervene additional messages but you get the idea.</p> <p>If for one reason or another you cannot derive a new control or override message handling, you can consider sub-classing the controls. Answer to <a href="https://stackoverflow.com/questions/3302389/synchronized-scrolling-components-delphi">this question</a> would show you how to do that.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload