Use images of a stack in another stack

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Use images of a stack in another stack

Post by FourthWorld » Thu Apr 25, 2019 7:45 am

You could do that if you need the card, but you don't need to that just to have icon images referenced.

You can use any icon of any other stack provided both stacks are in memory, and you load the one which references them.

LiveCode will first look for a referenced image in the stack that refers to it. If not found it'll look in other open stacks (in load order, IIRC).

And you'll want to use high IDs. Many lower IDs are either used by LC or just risk a likelihood of conflicting with another image in another stack.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Use images of a stack in another stack

Post by [-hh] » Thu Apr 25, 2019 10:24 am

You say you have a few images only. So copy the images from card x of stack A to card y of stack B and you are done.

jmburnod (Jean-Marc) already described above a way to do this by script.
You could also simply select the needed images on the source card (of stack A), copy, go to the destination card (of stack B) and paste.

(Copy the images, don't copy the buttons. Else there may arise reference problems.)
shiftLock happens

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Use images of a stack in another stack

Post by bogs » Thu Apr 25, 2019 1:26 pm

There was this nugget from the 'tips' stack that I have been playing with, which goes along with what Richard was talking about ~
Create a library of images
You don't need to open a stack to display an image from it. Just create a blank button and set its icon property to the ID property of the image. You can display images from any stack in memory--even if the stack isn't open!

To store images, create a substack of your main stack and place an image on each card of the substack. This makes it easy to scan all the images while keeping them in a separate window.
Image

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

Re: Use images of a stack in another stack

Post by Klaus » Thu Apr 25, 2019 1:51 pm

I also mentioned this on page 1, Mr. steel-trap-memory. :D

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Use images of a stack in another stack

Post by bogs » Thu Apr 25, 2019 2:37 pm

<~snap!~>
:D
Image

Post Reply