Page 1 of 1

Copy image to another card

Posted: Mon Oct 12, 2020 7:23 pm
by SEAL29
So far I have come:

Code: Select all

copy image "pic1" to card 3
But the position and rect is the same as source, how can i modify position or rect on card 3?
I tried this, but move the image on card 2 the new position

Code: Select all

copy image "pic1" to card 3
set the rect image "pic1" to "1203,174,1914,574"

Re: Copy image to another card

Posted: Mon Oct 12, 2020 7:38 pm
by Klaus
Hi SEAL29,

you are almost there :-)

Code: Select all

...
copy image "pic1" to card 3
## Now you are still on the SAME card, so you need to specify the correct ADDRESS of the image you want to modify:
set the rect OF image "pic1" OF CD 3 to "1203,174,1914,574"
## If that is what you mean.
...
Best

Klaus

Re: Copy image to another card

Posted: Mon Oct 12, 2020 8:06 pm
by SEAL29
Meanwhile I solved it, not as elegant as yours, but it works and you can even specify the location in the meantime. :D

Code: Select all

on mouseUp
   copy of image "pic1" to card 3
   go to card 3
   ask "Position:"
   put it into tNumber
   if the result = "cancel" then
      exit to top
   end if
   set the rect image "pic1" to tNumber
end mouseUp

Re: Copy image to another card

Posted: Mon Oct 12, 2020 9:03 pm
by Klaus
Hey, that's cheating! :D :D :D

But OF at the wrong position!

Code: Select all

on mouseUp
  ##  copy of image "pic1" to card 3
  copy image "pic1" to card 3
   go to card 3
   ask "Position:"
   put it into tNumber
   if the result = "cancel" then
      exit to top
   end if
  ## set the rect image "pic1" to tNumber
   set the rect OF image "pic1" to tNumber
end mouseUp
I am a bit picky in this respect, because, although it works currently, every new version of the LC engine is less forgiving with "sloppy" syntax! Believe me, I have been bitten by this fact several times in the last 21 years, and I have learned from that experience. :D

Re: Copy image to another card

Posted: Tue Oct 13, 2020 1:54 am
by dunbarx
Listen to Klaus about being careful with syntax. LC, like Hypercard before it, thought that forgiving syntax would make users feel more comfortable.

It did.

But LC has moved more into the mainstream, and this sort of looseness is becoming untenable.

Anyway, it is very useful to know that you can do anything you want to on other cards, or even cards on other stacks, WITHOUT actually navigating there. That is what was really important in what he suggested.

Craig

Re: Copy image to another card

Posted: Tue Oct 13, 2020 6:51 am
by richmond62
this sort of looseness is becoming untenable
To an extent.

There always seems to be at least 2 ways to achieve anything in LiveCode, and often many more: which is fantastic.

Re: Copy image to another card

Posted: Tue Oct 13, 2020 8:22 am
by FourthWorld
richmond62 wrote:
Tue Oct 13, 2020 6:51 am
this sort of looseness is becoming untenable
To an extent.

There always seems to be at least 2 ways to achieve anything in LiveCode, and often many more: which is fantastic.
Algorithmic flexibility is very valuable. One should be able to consider many different ways to solve a given problem, as we'd expect in any good language.

Syntactic flexibility seems less useful, possibly counterproductive. Having multiple ways to express the same algorithm just adds noise to the mastery-acuisition process.

Re: Copy image to another card

Posted: Tue Oct 13, 2020 12:31 pm
by richmond62
That's exactly what my narrow-minded Chemistry teacher said about titration calculations 42 years ago.

At University the Professor (when I asked her) said that 'how one got to the result' didn't matter as long
as the result was capable of being arrived at via a different route.

(x * x) = x^2

Re: Copy image to another card

Posted: Tue Oct 13, 2020 2:49 pm
by dunbarx
Syntactic flexibility seems less useful, possibly counterproductive. Having multiple ways to express the same algorithm just adds noise to the mastery-acuisition process.
I am with you 100%. Back in the (HC) day I selected, or rather my brain selected, (not the same thing) one version of each syntactical option. For example, describing a function given the "the" way or the "()" way. Never deviated. If there had been only one, I would still not have deviated.

Craig

Re: Copy image to another card

Posted: Tue Oct 13, 2020 4:13 pm
by richmond62
I think I have been traumatised by FORTRAN IV. 8)