Image placement from Library
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Image placement from Library
Is there a good way to programmatically place an image from the library? I can place and duplicate via button, but if i try to create that same image with matching id of the image in the library, i get a collision. To be clear, I'm not wanting to duplicate any item already placed on the card, I want to bring it from the library to the card via code.
Re: Image placement from Library
Let me clarify the context a little bit. 1. all objects on screen need to be created programmatically because the layout is dynamic. 2. I am needing to put everything into groups for control, and since there doesn't seem to be a good way to put things into groups without having created the object in that group or creating duplicates of an existing object (why is there no "put object in grp" ?). The objects in question are images. Is there a way to have an image exist only in the library, and the create the image into the group directly? Is there a better way?
Re: Image placement from Library
Hi Jeff,
In the case you described I use a group like template
I clone it and set the properties of each objects
I read "distractor", your stack is for people with special needs ?
Kind regards
Jean-Marc
In the case you described I use a group like template
I clone it and set the properties of each objects
I read "distractor", your stack is for people with special needs ?
Kind regards
Jean-Marc
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 328
- Joined: Mon Dec 05, 2011 5:34 pm
- Contact:
Re: Image placement from Library
SteveTX,
This response is assuming that your question was regarding a runtime situation - it's not really obvious from your question.
Also which Library are you referring to?
I think you need to understand what the image Library is. It's a construct in the IDE - and therefore will not exist at runtime. You cannot place items from it onto a card when the Library doesn't exist (at runtime).
What you can do though is make a card that is not shown to the user and put all the images from the Library that you want to use onto that card. The card can be on a substack if required.
Once you have that 'Library' card then you can copy/clone from it onto any card in your application. You can copy into groups very easily too.
I hope that helps a bit,
Dave
This response is assuming that your question was regarding a runtime situation - it's not really obvious from your question.
Also which Library are you referring to?
I think you need to understand what the image Library is. It's a construct in the IDE - and therefore will not exist at runtime. You cannot place items from it onto a card when the Library doesn't exist (at runtime).
What you can do though is make a card that is not shown to the user and put all the images from the Library that you want to use onto that card. The card can be on a substack if required.
Once you have that 'Library' card then you can copy/clone from it onto any card in your application. You can copy into groups very easily too.
Code: Select all
copy image "fred" of card "_hidden_library_card" to group "targetGroupName"
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
Visit http://electronic-apps.info for released App information.
Re: Image placement from Library
Hi,
Once you have this list you can use it to set the filename of images.
In this way you can use the same file for many images
Kind regards
Jean-Marc
I use a folder directory as library. A list of file path.Good question
Once you have this list you can use it to set the filename of images.
In this way you can use the same file for many images
Kind regards
Jean-Marc
https://alternatic.ch
Re: Image placement from Library
That makes some sense. The plain interpretation seems to be that if it isn't used in the stack, directly as an object or referenced by an object (icon/fill/etc), it ceases to exist in the image library. That behavior seems optimized to ensure minimal mainstack library size.