Webclient context menu Cut/Paste

Hi,

I have added a context menu to a text field to allow some custom functions to be accessed by the user which works exactly as I intended :D. Unfortunately what I had not anticipated was losing access to the cut/paste entries of the inbuilt browser menu :( . How can I add the equivalent of these actions to my context menu and am I missing some obvious way of doing this?

I am aware that the keyboard commands will still work but the users unfortunately cannot grasp that concept and want to be able to right click to paste from the clipboard.

Thanks
Steve

Have a look at:

application.setClipboardContent(elements.myElement.getSelectedText());

and:

var fromClipboard = application.getClipboardString();

Hi Jos,

Many thanks for that - I had been searching cu and past and never thought to use “clipboard” as a search term :oops:

Thanks
Steve

Hi Jos,

I have now had a chance to try your suggestion but cannot seem to get it to work. If I run my application in the smart client then everything is as expected but if I run it in the web client (all my clients are web clients) then it does not work

application.getClipboardString() always returns a null and application.setClipboardContent(myVar) copies nothing to the clipboard even though myVar contains some text.

Have you got this to work in the web client?

Thanks
Steve

Hi Steve,
I’m afraid javascript access to the clipboard is blocked by the browsers, so I don’t think this will work in webclient.

jdbruijn:
I’m afraid javascript access to the clipboard is blocked by the browsers, so I don’t think this will work in webclient.

That is not entirely true. But this excellent blog post pretty much explains the issues.