Martin wrote:
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;
Thanks Martin, noted. As an interim measure I ended up detecting ^C etc.
in the key-up event, which /might/ be safer since I'm already filtering
keys to implement an APL-style keyboard and /might/ be the only way to
handle e.g. a non-standard clipboard-swap operation. However I'll
revisit "the proper way" when some of the dust has settled, one
particular thing that I'll want to check is what happens when one runs
with e.g. a Sun keyboard which has explicit cut/copy keys.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus