Page 1 of 1

Putting images on my user interface stack

Posted: Thu Oct 23, 2008 2:39 pm
by Bruce Underwood
Background information:
I am using an i-MAC with OS 10.5.5
I am writing a program in which the user enters a calendar date and gets back the day of the week for the date plus an image of the phase of the moon for the entered date.
I have everything working fine up to the point of putting a moon image into a field. The program responds with a phrase such as "October 23 2008 is today, Thursday", and it works for any date from 9000 BC to 4000 AD. It is then supposed to put 1 of 16 images of the moon for that date into a field . The 16 moon images are located on a sub-stack. I can put the image there by using the Inspector, clicking on the folder, then selecting the image from an external folder. But I want to do it within the program, and that's where the problem lies.
I've tried a number of approaches, but always get an error message. It appears that I am not properly specifying the image I want to use.
Hope you can help. Bruce

Posted: Thu Oct 23, 2008 5:48 pm
by Klaus
Hi Bruce,

this is pretty easy...

1. Create an empty image in your mainstack, where you want to show a specific image.
2. Name it whatever you like. I use the name "moon image" in my example
2. Then add this to your script(s) that will display the correct date and moon phase in your mainstack:

Code: Select all

...
put img "name of your moon image in substack here" of cd X of stack "your substackname here" into img "moon image" of cd Y of "your mainstack name here"
...
Too obvious, isn't it?! :-)


Best

Klaus