Web clipboard

I would like to enable a user to right-click copy something from anywhere on their desktop and then go to my webapp where I can extract the contents of the desktop clipboard without the user having to go through the right-click or cntl-v process. Is there somewhere in Xojo-web that allow me to grab the clipboard content like what exists in the desktop version?

We don’t have a Clipboard class for the web, although there is a feature request for it.

To be clear, if/when we do have a clipboard class, the browser user will still need to paste the text. Javascript is not allowed to get the clipboard text unless there’s a Paste event in progress.

Thanks for the quick response. So, my users can already CNTL-C on the desktop and then CNTL-V in my web app. What is the key benefit of the web-clipboard feature then?

Being able to manipulate the data as it’s coming in, I suppose. We could (for instance) just send the clipboard content directly to the server, where you’d parse it and return it in some other way to the user without them seeing their pasted data. There’s also Cut and Copy operations, so you might be able to do something with those as well.

Thanks.

If you don’t want the end user to have to click a button or do anything other then cntrl-V just attach your processing to the TextChanged event for the field they paste into.

Using JavaScript and populating text from clipboard into WebTextField (by taking the {ControId}_inner) actually works, but unfortunately ONLY on client side. Xojo property “Text” of the web text field remains as it was before.
Any trick to set the text property?

You want to read WebControlSDK.pdf in the WebSDK folder, within the Extra folder, next to the Xojo executable.

It will show you how to send back data to the app, in order to modify Text.

Is there any way to “press” a set of keys to create the effect of entering text into a Clipboard?
I am displaying text on a ListBox and do not want to run into the problem of creating files with peoples’ data on my server for users to download, so am going to have to display the text into a text field and actually have users hit Ctrl-A and Ctrl-C… :confused: … or display the data in an HTML viewer. Blech.

[quote=481385:@Amy Barnes]Is there any way to “press” a set of keys to create the effect of entering text into a Clipboard?
I am displaying text on a ListBox and do not want to run into the problem of creating files with peoples’ data on my server for users to download, so am going to have to display the text into a text field and actually have users hit Ctrl-A and Ctrl-C… :confused: … or display the data in an HTML viewer. Blech.[/quote]
Unfortunately, since I originally answered this 6 years ago, a lot has changed with privacy and the browsers. Support for being able to arbitrarily copy into the users clipboard is now considered a security issue in many cases and the browsers will effectively prevent you from doing this. The thing they pretty much universally let you do is copy/paste text from/to a text field or text area.

Gotcha - I ended up using an HTMLviewer and custom code to display the data for the user to copy.

https://realmakers.net/cgi-bin/ll1r2/ledgerlite1r2.cgi

*needed a quickie app to compile mileage and expenses while I am doing my taxes. :confused: