In the demo application, I am using actions (TAction instances) in order to take advantage of OnUpdate or OnExecute events and provide a nice user experience to the user. If something is written in the leftmost memo component, the Copy Text button becomes enabled and the user can use it to set the clipboard content as text.
As the clipboard is no longer empty, the Paste Text button becomes enabled (only if the clipboard content is textual, of course). The same considerations apply to the second row of components, for graphic content. An additional click or touch-enabled label has been added to give the user a chance to clear the PasteImage component. At application startup (the main form's OnCreate event handler), we look up the platform service we desire, that is, the clipboard. The following code snippet shows how:
procedure TMainForm.FormCreate(Sender: TObject);
begin
if not TPlatformServices.Current.SupportsPlatformService...