[Lazarus] Hooking Synedit's cut and copy shortcuts

Martin lazarus at mfriebe.de
Sat Dec 22 16:24:22 CET 2012


On 21/12/2012 19:54, Mark Morgan Lloyd wrote:
> I'm in the middle of adding a shared clipboard to a text editor based 
> on (Lazarus's) SynEdit. This is a simple stopgap based on a backend 
> database, but also allows me to exercise PostgreSQL's listen/notify 
> and hopefully also the Firebird equivalent both of which I want for 
> something else.
>
> What I've got works fine if I use a menu entry to do copy or cut, but 
> is there a simple way to hook SynEdit's reaction to ^C and ^X so that 
> I can transfer stuff to the backend automatically?
>
OnProcessCommand

(if not that then OnProcessUserCommand  commands are splitted into build 
in and user. ecCopy ecCut ecPaste should be build in)

The above only works if lynedit handles the keyboard.

If you call SynEdit.CopyToClipboard (TAction might do that?) then the 
above does not trigger



use

     property OnCutCopy: TSynCopyPasteEvent read FOnCutCopy write 
FOnCutCopy;
     property OnPaste: TSynCopyPasteEvent read FOnPaste write FOnPaste;


which should always trigger




More information about the Lazarus mailing list