Images in standalones

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dalkin
Posts: 176
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Images in standalones

Post by dalkin » Thu Sep 09, 2021 10:47 am

I've read the lessons and tried the following without success.

I want to save the entries in various fields and it works a treat when I launch a splash stack (call it the primary stack) that, in turn, launches the stack with the for-saving fields (call it the secondary stack). All good, no problem. The problem arises though with an image in the 'secondary' stack. In the IDE, the path to the image is shown in the secondary stack, but the 'save-as-standalone' dialog is only relevant to the 'splash' stack and no variation is working to 'embed', or otherwise reference, the referenced image file in the 'secondary' stack. In the standalone build, the image does not appear.

Load your 38s, spin the cylinder, pull the trigger and put me out of my misery.
If we're treading on thin ice, well you might as well dance.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Images in standalones

Post by Klaus » Thu Sep 09, 2021 11:57 am

Hi dalkin,

I'm german, no guns over here! 8)

Let me see if I get it right.
1. You have a stack "stack1" that is turned into a standalone -> the famous SPLASH stack
2. You have another separate stack that gets saved -> "stack2"
3. 1. opens 2.
4. There is an image in "stack2" that is not displayed in the runtime.

Did you add that image to stack2?
If yes, why not just IMPORT AS CONTROL that image?
If not, how does the image get into that stack2?

If you want to reference images use RELATIVE pathnames = relative to the (runtime) stack.
Do like this:
1. In the IDE put the image(s) into the folder with the stack1, either as separate files of in a folder
2. Enter the filename in the inspector for that image RELATIVE, means simply the filename without
any folder reference -> my_image.jpg
3. Add your image or folder of images to your later runtime via "Copy files" in the "Standalone Application settings"
4. This way LC will map that folder to your runtime app structure as if it was in the IDE:
stack1
my_image.jpg
5. You can also access that folder via script with- -> specialfolderpath("resources")
This folder will also work in the IDE where it point to the folder the current stack resides in.
So if 2. does not work for you, you can later script:

Code: Select all

...
set the filename of image "your formerly missing image" of cd 1 of stack "stack2" to (specialfolderpath("resources") & "/my_image.jpg")
...
Hope I got it right! :-)


Best

Klaus

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Images in standalones

Post by stam » Thu Sep 09, 2021 3:20 pm

What Klaus says! (as always ;) )

either import as control and reference it by it's ID, or copy as external file in the standalone build settings and reference it via specialFolderPath("resources")/<image file name>

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”