Displaying an image from another stack

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Pebah
Posts: 23
Joined: Mon Aug 01, 2011 9:35 pm

Displaying an image from another stack

Post by Pebah » Wed Aug 24, 2011 2:23 am

I have a main stack and also a substack that contains images. I want grab and display an image in the main stack from one that lives in the substack. I'm having trouble with the syntax to do this. The substack image control is reading from a binary file and has resized it. I want to use that modified version of the image.

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Displaying an image from another stack

Post by Klaus » Wed Aug 24, 2011 11:11 am

Hi Pebah,

use a button to display the image :D

Do this:
Go to your substack and note the ID of your image
Create a button (no border, no nothing, you can even DISABLE that button, since it should only display your image)
and set its ICON to the ID of the image in the substack via the "Inspector" paltette or script:
...
set the icon of btn "you button here" to 1007
## YOUR ID here of course!
...
Done :)


Best

Klaus

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Displaying an image from another stack

Post by jmburnod » Wed Aug 24, 2011 2:34 pm

Hi Klaus,

It is ok for display the image but an other point is how to grab the image from the substack to the main stack
I want grab and display an image in the main stack from one that lives in the substack.
Best from Geneva beach

Jean-Marc
https://alternatic.ch

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Displaying an image from another stack

Post by AndyP » Wed Aug 24, 2011 2:55 pm

Hi Pebah,

Try this:

In the main stack:

on openStack
put image id 1003 of stack "mysub-stack" into image id 1004 of this stack
end openStack

This assumes you have a sub stack named "mysub-stack" containing an Image with the id 1003 and an empty Image Area on your main stack of id 1004.
Andy .... LC CLASSIC ROCKS!

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Displaying an image from another stack

Post by Klaus » Wed Aug 24, 2011 4:19 pm

Hi Pebah,

oh, sorry, overlooked the GRAB part!

But Andy is correct, you can simply copy an image with
...
put img "name of img in substack" of cd X of stack "the substack" into img "the image on the current card"
...
:D


Best

Klaus

Post Reply