extending the delphi TEditCopy action to also copy listbox items to clipboard
Posted
by PA
on Stack Overflow
See other posts from Stack Overflow
or by PA
Published on 2010-04-16T10:56:22Z
Indexed on
2010/04/16
11:03 UTC
Read the original article
Hit count: 232
I have a form with most of its functionality implemented using standard TAction. I have a menu, a toolbar, and some toobuttons. I have implemented clipboard copy/paste with no code at all, just using TEditCopy and TEditPaste actions. It works perfect in the TEdit and TMemo boxes I have.
Now, I want it to work with TListBox, too. Specifically, I want to be able to copy the selected list item in a TListBox using the very same menuitems, key shortcuts and toolbuttons.
So, I believe I will need to extend the TEditCopy Action. But it doesn't seem very straight forward to me. In particular, the TEditAction checks for the focused control to be a TCustomEdit control, which a TListBox it is not. I am a little affraid that it will be just too much work.
The obvious alternative is to just forget about the standard actions and implement the copy to clipbard in the OnExecute method of a generic TAction.
But, before giving up, do you have some idea, hint or trick that would help me extend the standard TEditCopy action?
© Stack Overflow or respective owner