Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-12

Intercept clipboard operations

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

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?

Bart

Reply by email

Mattias Gaertner
to Bart
Show quoted text 24 lines
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

Reply by email