Copy To Clipboard from Preview, undeclared identifier
Hi there,
I have been trying to work out a way of allowing a user to click an element (DBText) of a viewed report and sending the FieldValue to their System Clipboard. This is because they cannot drag + select text, then Right-click to copy or do Ctrl+C, and there are some complex bits of information that they would benefit from copying straight from the report preview instead of having to export it and copy from the exported file.
I have seen that a solution has been suggested in the past for this by using OnDrawCommandClick and TClipBoard.
Both here: ability to copy value from a preview to clipboard
and here: Selecting Text in Preview
I've tried to implement this in the OnDrawCommandClick event, but whenever I try to use TClipBoard, ClipBoard, or ClipBrd (all classes I have seen mentioned in solutions from Delphi forums) I get an error saying Undeclared identifier: 'TClipBoard' (or ClipBoard/ClipBrd)
I assume there is something I am missing. How can I get my report in the Report Builder to recognise TClipBoard to use?
procedure MyTextOnDrawCommandClick(aDrawCommand: TObject);
begin
TClipBoard.astext := MyText.FieldValue
end;
Error: MyTextOnDrawCommandClick, Line 3: Undeclared identifier: 'TClipBoard'.
I am using Report Builder version 21.02.286
I have been trying to work out a way of allowing a user to click an element (DBText) of a viewed report and sending the FieldValue to their System Clipboard. This is because they cannot drag + select text, then Right-click to copy or do Ctrl+C, and there are some complex bits of information that they would benefit from copying straight from the report preview instead of having to export it and copy from the exported file.
I have seen that a solution has been suggested in the past for this by using OnDrawCommandClick and TClipBoard.
Both here: ability to copy value from a preview to clipboard
and here: Selecting Text in Preview
I've tried to implement this in the OnDrawCommandClick event, but whenever I try to use TClipBoard, ClipBoard, or ClipBrd (all classes I have seen mentioned in solutions from Delphi forums) I get an error saying Undeclared identifier: 'TClipBoard' (or ClipBoard/ClipBrd)
I assume there is something I am missing. How can I get my report in the Report Builder to recognise TClipBoard to use?
procedure MyTextOnDrawCommandClick(aDrawCommand: TObject);
begin
TClipBoard.astext := MyText.FieldValue
end;
Error: MyTextOnDrawCommandClick, Line 3: Undeclared identifier: 'TClipBoard'.
I am using Report Builder version 21.02.286
Comments
TClipboard is a Delphi class located in the VCL.Clipbrd file. It is not natively available in RAP (code workspace in ReportBuilder).
In order to access a Delphi feature such as this from RAP, a pass-thru function will need to be created. See the main RAP demo included with ReportBuilder on creating, registering, and using RAP pass-thru functions.
Moving forward, we will consider adding access to the TClipboard class directly from RAP for a later release.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I thought I was missing something, so this makes sense.
I'll look into a pass-thru function.