TAdvListEditor - how to hook "paste" operation

I need to hook Paste operation on TAdvListEditor to pre-process data being pasted into it.

The data is multi-line, I need to have it in single line, before I paste into TAdvListEditor.

I tried subclassing TAdvListEditor and capturing WM_PASTE in WndProc() but that never occurs (WM_PASTE never appears) although a number of other messages are passing through WndProc() so can't be done like that.

I also tried event - OnValueEditDone.

In that method there is a EditText which can be modified before it is inserted. That value is always 1 line (first line of the pasted text).

How can I capture raw paste data?

WM_PASTE will indeed not work due to how the control is constructed.

This is a good idea & suggestion. So, we extended the component to offer a new event OnValuePaste(Sender: TObject; var Value: string; var Allow: boolean);

The next release will feature this new event.

1 Like

Thanks Bruno, that looks very good, but will the Value hold the original value which may be modified? The Clipboard input is multi-line and I have to convert it in the OnValuePaste event to the appropriate single-line data before it is passed through to the component.

Yes it can do exactly that.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.