[Lazarus] Intercept clipboard operations

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Dec 28 09:42:32 CET 2008


On Sun, 28 Dec 2008 00:53:33 +0100
Bart <bartjunk64 at gmail.com> wrote:

> Hi,
> 
> I ran into a problem with the MaskEdit unit that I'm working on.
> 
> I want to intercept clipboard operations (like when the users presses
> Ctrl-V, Ctrl-X or uses the mouse-equivalent) before the text in the
> editcontrol gets changed.
> 
> Currently I have
> 
> TCustomMaskEdit = Class(TCustomEdit)
> 
> ...
>     procedure LMPasteFromClip(var Message: TLMessage); message
> LM_PASTE; 
>     procedure LMCutToClip(var Message: TLMessage); message
> LM_CUT; 
>     procedure LMClearSel(var Message : TLMessage); message
> LM_CLEAR; ...
> 
> However, when these procedures are called, the text in the control has
> already been overwritten. I especially want to validate the content of
> the pasted text before it is pasted into the control.
> Is this (in a cross-platform way) possible at all?

No.
Unless you implement LM_BeforePaste messages for all widgetsets.

Mattias



More information about the Lazarus mailing list