Move an image to another card in my standalone

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
brandnoobian
Posts: 5
Joined: Fri Jun 06, 2014 4:00 pm

Move an image to another card in my standalone

Post by brandnoobian » Mon Jun 09, 2014 9:06 pm

Greetings from Pensacola Florida!

I'm new to the forum, new to LC, and new to developing apps. I find that learning LC is a fun experience and I have learned alot from this board. Thanks!

I'm attempting to make my first original app (for android first, and later for iPhone) and here is my question- How come this works in LC but not in my standalone which I am testing on an AVD:

Code: Select all

put img "image" into img "Image" of cd 1
It works for the text fields that I move from card 2 to card 1, but the image just remains blank. I have my suspicions of what I'm doing wrong and have been searching for the correct way to do this, but I've been stuck for days and figured its time to ask for help.

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Move an image to another card in my standalone

Post by sefrojones » Mon Jun 09, 2014 9:21 pm

try this:


Code: Select all

put img "image" of cd YourCard into img "Image" of cd 1

where yourcard is the card containing the image to be moved to the new cd (1).
--Sefro

edit: this method requires that there is already an image "image" on cd 1 If that is not the case maybe the copy command is what you're looking for.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10335
Joined: Wed May 06, 2009 2:28 pm

Re: Move an image to another card in my standalone

Post by dunbarx » Mon Jun 09, 2014 9:25 pm

I could be wrong, but I do not think you can "put an image into an image". An image is simply a control that contains a bitmap.

What are you really trying to do, putting an image into another image? To merge them? Or are you just trying to move an image from one card to another? In other words, is the "copy" command what you really need here?

Craig Newman

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Move an image to another card in my standalone

Post by sefrojones » Mon Jun 09, 2014 9:31 pm

Craig,

I actually tested this and you can indeed put an image into another image this way. Not sure if it's the best way to do what Brandon is trying to do, but it works. Attached the stack I used to test this method...


--Sefro

PutImage.zip
(115.77 KiB) Downloaded 167 times
Edit: Just tested this stack on android, and it is confirmed working there as well.....

brandnoobian
Posts: 5
Joined: Fri Jun 06, 2014 4:00 pm

Re: Move an image to another card in my standalone

Post by brandnoobian » Mon Jun 09, 2014 10:12 pm

Thank you for the fast responses!

No, there isn't an image already on card 1. I'm trying to move an image from card 2 to a blank image area I placed on card 1. So yes, I guess I should be using the "copy" command (even though the "put" command works ok in LC?).

But I don't want to mislead you as to what I am trying to do with the image. I want to use it in a datagrid form on card 1. What I've been doing so far works in LC, which is "putting" the image into the image area of card 1, and then, after exporting and renaming it, using the image when adding a row to the datagrid.

So I should use the "copy" command in this case? I tried

Code: Select all

copy img "image" of cd 2 to image "Image" of cd 1
but looks like I'm wording it wrong because it doesn't seem to work.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10335
Joined: Wed May 06, 2009 2:28 pm

Re: Move an image to another card in my standalone

Post by dunbarx » Mon Jun 09, 2014 10:15 pm

Sefro.

So you can. The image you "put" replaces the image that was there. I guess this works similarly to chunks, where you put text into a container, and the contents are replaced.

I was reading Brandon's post either as an attempt to make a composite image, or to simply move one image to another destination. Copying just copies. So if the intent was to replace the original image, then the "put" method does what is required. This all begs the question why his does not work at all. I assumed he was already on cd 2 when he ran his code, though I thought, as you did, that might be the issue. So Brandon, were you on cd 2?

Craig

brandnoobian
Posts: 5
Joined: Fri Jun 06, 2014 4:00 pm

Re: Move an image to another card in my standalone

Post by brandnoobian » Mon Jun 09, 2014 10:51 pm

sefrojonesGAda40 wrote:Craig,

I actually tested this and you can indeed put an image into another image this way. Not sure if it's the best way to do what Brandon is trying to do, but it works. Attached the stack I used to test this method...


--Sefro

PutImage.zip
Edit: Just tested this stack on android, and it is confirmed working there as well.....
Thanks for the rev file, they are very helpful and I'm building a nice collection of these!

I tried your method and it didn't work for me, but there's a big chance I missed something, I will try again...

brandnoobian
Posts: 5
Joined: Fri Jun 06, 2014 4:00 pm

Re: Move an image to another card in my standalone

Post by brandnoobian » Mon Jun 09, 2014 10:55 pm

Yes Craig, I am going from card 2 to card 1.

On Card 2 I am scraping some stuff from an http URL that the user puts in, getting the image, resizing it, and then cropping it. I have code on a button that places the stuff that was scraped from the URL into fields on card 1, and then "go to card 1". I then use the fields and the image on card 1 to add a row to a datagrid.

But I was confused as to why the code I was using to move the image from card 2 to card 1 was working in LC and not in the AVD, and I was hoping that answer would lead me to why the datagrid was not working in the AVD.

brandnoobian
Posts: 5
Joined: Fri Jun 06, 2014 4:00 pm

Re: Move an image to another card in my standalone

Post by brandnoobian » Tue Jun 10, 2014 3:51 am

Looks like I got it working lol....

My suspicions were correct, I had to save the file to "documents" before going to card 1 and then put the file into the image area on preOpencard, it just took me a few days to learn how to actually save and then get the image lol....

However I'm still little frustrated about how the whole app worked perfectly in LC but not so much as a standalone. I wasn't expecting to have to make so many changes to the script.

Thanks for the responses on this post. I'm learning alot every day! Now I can tackle getting the datagrid to work on android :P

Post Reply