Page 1 of 1

Image placement from Library

Posted: Sat Jun 29, 2013 2:04 am
by SteveTX
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

Posted: Sat Jun 29, 2013 7:46 am
by SteveTX
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

Posted: Sat Jun 29, 2013 9:47 am
by jmburnod
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

Re: Image placement from Library

Posted: Sat Jun 29, 2013 11:21 am
by dave_probertGA6e24
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.

Code: Select all

copy image "fred" of card "_hidden_library_card" to group "targetGroupName"
I hope that helps a bit,
Dave

Re: Image placement from Library

Posted: Sat Jun 29, 2013 2:22 pm
by jmburnod
Hi,
Good question
I use a folder directory as library. A list of file path.
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

Re: Image placement from Library

Posted: Sat Jun 29, 2013 7:28 pm
by SteveTX
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.