Use images of a stack in another stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
Use images of a stack in another stack
Hello,
I have images in a card that I use without problems through the property inspector.
I would like to use them also in another card of a different stack, but from the property inspector do not appear, do I have to duplicate the card in the stack in use or do I have to call them by code?
Thank you
I have images in a card that I use without problems through the property inspector.
I would like to use them also in another card of a different stack, but from the property inspector do not appear, do I have to duplicate the card in the stack in use or do I have to call them by code?
Thank you
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Use images of a stack in another stack
Hi Alessio,
You may set the text of your destination image to the text of the source image if it is a non referenced image.
Using external file is an other way. External file can be use by several stacks. . You have to create a common folder with image files.
Best regards
Jean-Marc
You may set the text of your destination image to the text of the source image if it is a non referenced image.
Code: Select all
set the text of image "myImg" of stack "myStackDest" to the text of image "OneImg" of stack "myStackSource"
Code: Select all
set the filename of image "myImg" of stack "myStackDest to MyPathfile.
Jean-Marc
https://alternatic.ch
Re: Use images of a stack in another stack
We cannot use any LC object from one stack in anohter stack.
Why do your think images would behave differently?
The ONLY way to do so is to use a button (in stack A ) and set its ID to the id of the image from the other stack (stack B). But that will only work if there is no image in the stack (stack A) with the same ID already.
Why do your think images would behave differently?
The ONLY way to do so is to use a button (in stack A ) and set its ID to the id of the image from the other stack (stack B). But that will only work if there is no image in the stack (stack A) with the same ID already.
Re: Use images of a stack in another stack
I'm curious, wouldn't grouping the images and setting the shared make them accessible anywhere? Like a bg that isn't placed on every new card.
Re: Use images of a stack in another stack
Yes, but on a "per stack" base!
Re: Use images of a stack in another stack
Excuses, excuses, excuses...
Re: Use images of a stack in another stack
Actually, if I remember something Jacque said once correctly, you *could* put all the images in a bg group on the main stack, then delete the group and it (and the images) would still be there.
Hope I got that right
Re: Use images of a stack in another stack
Since LC loads the complete stack into RAM, this makes sense.
But I would surely not deliver a (commercial) standalone with this concept!
But I would surely not deliver a (commercial) standalone with this concept!
Re: Use images of a stack in another stack
Yes, that could be bad
I'm curious about something else I haven't really experimented with (the list is legion in size). If you had a library stack with your images, would it be workable that way?
I'm curious about something else I haven't really experimented with (the list is legion in size). If you had a library stack with your images, would it be workable that way?
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Use images of a stack in another stack
Almost. You don't delete the group, you just remove it from the one card it's on. The group remains as part of the stack that way but isn't displayed anywhere. {This is how MC uses resources from imported HC stacks.) All cards, buttons, etc. in the stack can use the images as icons. If the stack is put in use, then other stacks can also use the images if their buttons are set up with matching icon IDs.
I have a large project that downloads stacks on demand, and they all use the icons stored in the mainstack/app this way. You do have to set the image IDs to very large numbers to avoid ID conflicts, I think mine are in the 500,000 range and up.
Edit: this is essentially your library stack idea and yes, it does work. But I think the OP was looking for image sharing rather than icons. In that case, copying or setting the imageData works. Or you could just make a transparent button as large as the image and set its icon.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Use images of a stack in another stack
OOOOOooooohhhhhhh, I see. When you said 'remove', I was thinking remove by deletion. How do you remove it without deleting it? Just choose 'cut object' ?
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Use images of a stack in another stack
Just as you can place a group on a card, you can also remove it from the card. The options are in the Objects menu. Select the group and choose Remove from the menu. Or you can use the command from the message box (see "remove" in the dictionary.)
This method does mean that you have to temporarily place the group again if you want to edit it, then remove it when you're done.
BTW, I'm using this method in a commercial product that's been sold for years and haven't had any trouble with it.
This method does mean that you have to temporarily place the group again if you want to edit it, then remove it when you're done.
BTW, I'm using this method in a commercial product that's been sold for years and haven't had any trouble with it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Use images of a stack in another stack
LOL!
I think I need to spend a bit more time in (any) version of Lc/rev, in Mc, there is no 'Objects' menu, I don't think I ever even looked at it in the rev/lc menus (Something I'll need to go add to Mc )
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
Re: Use images of a stack in another stack
It's nice that my questions give way to debates that are always so shared
Turning to the question, given that the images are few and I use them in some buttons, could it be corrected if I recreated the card in the new stack or is it wrong?
Turning to the question, given that the images are few and I use them in some buttons, could it be corrected if I recreated the card in the new stack or is it wrong?