| Author |
Copying image to clipboard
|
jasdeep parmar
Greenhorn
Joined: Oct 06, 2008
Posts: 20
|
|
Hi,
I am using smartgwt 2.2 for my application. I have customized context menu on right click on an image, I need to add a copy to systems clipboard functionality so i can copy an image from app then paste in somewhere else like (paint) . Is there a way I can accomplish it?
thanks
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
|
Why are you writing your own functionality for this? Doesn't the browser provide this already?
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
jasdeep parmar
Greenhorn
Joined: Oct 06, 2008
Posts: 20
|
|
the reason I am writing my own is becuause i have to provide other customized options in that menu which browser doesn't provide..
thanks
|
 |
salvin francis
Ranch Hand
Joined: Jan 12, 2009
Posts: 915
|
|
if it helps:
javascript for copying image from a div
var div = document.getElementById('divId');
div.contentEditable = 'true';
var controlRange;
if (document.body.createControlRange) {
controlRange = document.body.createControlRange();
controlRange.addElement(div);
controlRange.execCommand('Copy');
}
div.contentEditable = 'false';
I dont think this will work in non IE browsers and i advise against using browser specific script.
Always remember that you are working on a browser, Its never going to act like a desktop application,
You cannot (for example) drag and drop files from your pc into your application.
|
My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
|
 |
 |
|
|
subject: Copying image to clipboard
|
|
|