#1 2016-05-13 16:28:13

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

How would I copy an image to the clipboard for android? IOS?

David or anyone,

I have an image I want the user to CLICK (or double-click on).  When the action is performed, I want it copied automatically to the clipboard.  How would I do this?  Is it the same for Android as it is for IOS?

Thank you.

Mike

Offline

#2 2016-05-13 16:37:34

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello,

Unfortunatelly I did not hear before about copy images into the clipboard. Apparently we can do it with text, at least using the below Cordova's plugin:

https://github.com/VersoSolutions/CordovaClipboard

... but I don't know about images... What you want to do? Maybe a another approach can be taken.

Offline

#3 2016-05-13 16:51:44

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

OK - the app has a drop down with categories (sports).  If you choose baseball, for example, then it will show all baseball emoji (custom emoji graphics).  I then want the user to be able to click (or double click) one which will copy it to the clipboard so that they can then paste it into a text, document or whatever.

That is what I am trying to do.

Mike

Offline

#4 2016-05-13 16:57:10

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello Mike,

karmacomposer wrote:

OK - the app has a drop down with categories (sports).  If you choose baseball, for example, then it will show all baseball emoji (custom emoji graphics).  I then want the user to be able to click (or double click) one which will copy it to the clipboard so that they can then paste it into a text, document or whatever.

That is what I am trying to do.

Mike

Then we are talking about copy the image's URL, not the image properly said. In that case we can use the refered plugin to deal with the Clipboard:

https://github.com/VersoSolutions/CordovaClipboard

This plugin is a good candidate to be added in App Builder "out of the box", however, I have no time right now to promise a day for that... but remember we can use the plugin even if they are not included in App Builder "out of the box": what we need to do is use the plugin Javascript API directly.

But now we enter in another point. Are the images we are talking about in a remote server? If so, we can use the "[ImageName.Image]" variable to be saved into the Clipboard, since that variable store the image URL.

Are the images we are talking about included by the application when compile it? Then I am not completely sure if the "[ImageName.Image]" can help us "as is". Of course such variable contains an URL, however, I am not sure what kind of URL is this (in Android, for example) and if they can be simply copied and used in another context.

Offline

#5 2016-05-13 17:52:55

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello,

I am also study this stuff:

https://clipboardjs.com/

Offline

#6 2016-05-13 18:01:23

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello again,

After taking a look (again, because I remember do it in the past) to clipboardjs.com and perform some tests I think this can be the option for us. I did not text in Android yet, but, since they are a Javascript solution, I think they can work without problems. If I found it working in Android (as well in browsers) I want to add a non visual Clipboard control to App Builder based in this stuff.

P.S. Remember you no need to wait... since it's possible to use the clipboardjs.com Javascript directly from our applications.

Offline

#7 2016-05-13 19:07:35

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

Great!  Any idea how I would code that in App Builder?  I came up with this:

<!--Read in script-->
<script src="dist/clipboard.min.js"></script>

<!-- Target -->
<img id="bar" src="/emoji/baseball.png"></img>

<!-- Trigger -->
<button class="btn" data-clipboard-action="copy" data-clipboard-target="#bar">
    Cut to clipboard
</button>

Does this look right?  How would I code this in my app builder app?  I am very new to programming javascript in your software, so not sure how to do it properly.

Thanks for your help.

Mike

Offline

#8 2016-05-13 19:10:54

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello,

Well. In fact the "clipboard.js" project offer us a way in order to about the usage of HTML markup. In fact we can add the "clipboard.min.js" file using the app's file's manager, and then use a Javascript like the below one:

    var clipboard = new Clipboard('.btn', {
        text: function() {
            return 'to be or not to be';
        }
    });

    clipboard.on('success', function(e) {
        console.log(e);
    });

    clipboard.on('error', function(e) {
        console.log(e);
    });

Anyway, I am in the process to add a Clipboard control and the right sample for it. I expect to be ready this afternoon, so, you decide if you want to wait or you want to use the above Javascript: both things can be good Mike.

Offline

#9 2016-05-13 19:46:07

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello,

Between other changes, this can be read in the current App Builder release history:

Add the new non visual Clipboard control. This control allow us to copy text into the system clipboard from our applications in conjuction with the also new CopyToClipboard action. Take also a look at the new Clipboard application sample to view it working.

Hope they can be useful for you and others Mike.

Offline

#10 2016-05-14 05:42:22

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

I tried to download the update from within App Builder (check for updates), but received the error: "IOHandler value is not valid".

Now what?

Mike

Offline

#11 2016-05-14 05:46:05

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

OK.  Downloaded it from your site.  How would I use the sample app code to copy and paste the emoji images?

Mike

Offline

#12 2016-05-14 10:32:00

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello,

Please, Mike, take a look at my above post:

David wrote:

But now we enter in another point. Are the images we are talking about in a remote server? If so, we can use the "[ImageName.Image]" variable to be saved into the Clipboard, since that variable store the image URL.

Are the images we are talking about included by the application when compile it? Then I am not completely sure if the "[ImageName.Image]" can help us "as is". Of course such variable contains an URL, however, I am not sure what kind of URL is this (in Android, for example) and if they can be simply copied and used in another context.

Offline

#13 2016-05-16 16:44:39

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

When I try copytoclipboard (thank you for making this command) on Image1.image I get "undefined" on the clipboard.

I am using an image control with the image located on my hard drive.  Even if I use the file manager and embed the graphic (baseball.png) and show the relative path ("/app/images/baseball.png") it still shows up as "undefined".

What am I doing wrong?

Here is the off screen clipboard control code (as per your example):

AlertBox "Image copied!" "success"

If "[CutAfterCopy]" "==" "true"
  SetVar "[Image1.image]" "" "String"
EndIf

Here is the copy to clipboard button code (as per your example):

// Just do it!
SetVar "[CutAfterCopy]" "false" "String"
// CopyToClipboard "Clipboard1" "[Textarea1.Value]"
CopyToClipboard "Clipboard1" "[Image1.image]"

Mike

Last edited by karmacomposer (2016-05-16 16:48:42)

Offline

#14 2016-05-16 21:12:42

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello,

Please take care about the match case. "[Image1.image]" is undefined because in fact we must to use "[Image1.Image]". Note the first upper cased "I" for the "Image".

Offline

#15 2016-05-16 21:21:10

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

OK.  That worked!  However, when used on Android, when the user PASTE'S the clipboard contents to a text or email, will the image show up or just the path to the image?  I need the image to be pasted.  Is there any way to run this app on my Android phone to test - like a simulator?

Now I just need to figure out how to create multiple containers of some kind that can scroll and hold a number of small images (emoji) each and have them all be hidden until selected via the dropdown control (pick Baseball and the baseball emoji container displays, ready to be used with the copytoclipboard control.

How would I go about doing this?  Thank for the hand holding while I get this done.

Mike

Last edited by karmacomposer (2016-05-16 21:24:47)

Offline

#16 2016-05-16 21:24:38

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello Mike,

Are you take a look at the Report control? App Builder includes various "Report*" samples, which can be give us an idea of this control power...

Offline

#17 2016-05-16 21:26:24

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

I will look seriously at the report control.

I assume I use the Hidden option to hide/unhide

Image1.Hidden = "true";

Something like that?

I assume I can do that to an entire Report holding a bunch of images?

Mike

Last edited by karmacomposer (2016-05-16 21:29:08)

Offline

#18 2016-05-16 21:36:00

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello,

Not exactly. To hide an element from a Report control we must "drop" it from the Report JSON source. That's the way. Maybe we can use an HTML control here instead of a Report control. But in both cases we are not talking about "Images.Image" anymore Mike.

If we decide to use a Report control then we have "items" and "item's properties" (what we want to put in a Report item, anything a JSON allow us) and if we use an HTML Control we are talking (probably) about HTML IMG elements "IDs" and "SRC" attributes.

Offline

#19 2016-05-19 18:29:09

karmacomposer
Member
From: Wesley Chapel, Florida
Registered: 2016-05-04
Posts: 84
Website

Re: How would I copy an image to the clipboard for android? IOS?

David,

It was great chatting with you.  I had to take a phone meeting, so I apologize for leaving so abruptly.

As soon as you can, i'd still like to chat with you about paying for your services to finish my project.

Mike

Offline

#20 2016-05-19 19:57:20

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How would I copy an image to the clipboard for android? IOS?

Hello Mike,

You're welcome. Hope you catch the app background issue. Please contact me by email or using the website contact form in order to talk about your project and a possible way to help you.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.