Page 1 of 1
Image not shown
Posted: Fri Sep 26, 2014 5:27 pm
by francof
Hi all,
In a card I have some jpeg images imported as control. at user's choice I want to show one of these into a image area.
I have tried this
Code: Select all
put img "aglianico" into img "imgFoto"
no error is given, but no image is show.
thanks for help
best
franco
Re: Image not shown
Posted: Fri Sep 26, 2014 5:58 pm
by sefrojones
Are the imported images on the same card as the image area? If not you should try something like this:
Code: Select all
put img "aglianico" of cd MyImagesCard into img "imgFoto" of cd MyDisplayCard
You may also want to refer to the images by ID number instead of name...
--Sefro
Re: Image not shown
Posted: Fri Sep 26, 2014 6:56 pm
by francof
Hi Sefro
yes, they are in the same card.
sefrojones wrote:
...
You may also want to refer to the images by ID number instead of name...
--Sefro
I will try
ciao
franco
Re: Image not shown
Posted: Fri Sep 26, 2014 7:01 pm
by Klaus
Buonasera Franco,
"put img 1 into img 2" will only work with IMPORTED images mot with referenced images!
In that case do:
Code: Select all
set the FILENAME of img 2 to the filename of img 1
Best
Klaus
Re: Image not shown
Posted: Sat Sep 27, 2014 9:25 am
by francof
Hi Klaus,
I do not understand where I'm wrong, no error given, but no image displayed
Code: Select all
put (the selectedText of fld tNomeFld & ".jpg") into tFoto
set the filename of img "ImgAnteprima" to the filename of img tFoto
the referenced images are named like the content of the rows of a list field.
E.G. for Mary in the field there is a picture mary.jpg in the card.
anyway I have tried also to directly use the name of the image:
Code: Select all
set the filename of img "ImgAnteprima" to the filename of img "aglianico.jpg"
same result.
best
franco
Re: Image not shown
Posted: Sat Sep 27, 2014 12:00 pm
by jmburnod
Hi Franco,
Nothing wrong for me in your script.
The mistake is elsewhere.
What do you get in tFoto ?
What is the filename of img tFoto ?
best regards
Jean-Marc
Re: Image not shown
Posted: Sat Sep 27, 2014 9:00 pm
by francof
Hi Jean-Marc,
into tFoto I put the name of the image I want to show, obtained with the content of the line I have clicked in the list field (e.g.: aglianico) + the constant ".jpg" the result is aglianico.jpg, which is the file name of the referenced image in the card.
the file name is correct, I'm sure, as said I have no error in the script.
for test I have put this:
Code: Select all
set the layer of img (the selectedText of fld tNomeFld & ".jpg") to top
the image is correctly put in front of all the others. boh!
one more thing: if a image is not existing, how can I intercept the message to avoid the error: :"... execution error at line 43 (Chunk: no such object)..."
ciao
franco
Re: Image not shown
Posted: Sat Sep 27, 2014 10:15 pm
by jmburnod
Hi Franco
how can I intercept the message to avoid the error: :"... execution error at line 43 (Chunk: no such object)..."
just this:
Code: Select all
if there is an img "myNameImage" then
Re: Image not shown
Posted: Sun Sep 28, 2014 9:41 am
by francof
Hi Jean-Marc,
jmburnod wrote:Hi Franco
how can I intercept the message to avoid the error: :"... execution error at line 43 (Chunk: no such object)..."
just this:
Code: Select all
if there is an img "myNameImage" then
so easy, I always forget LC is english like.... or this may be my problem.
well for now, instead to put the selected image in the Image Area object, I show and put it on the front over all others images.
Code: Select all
if there is an img (the selectedText of fld tNomeFld & ".jpg") then
set the layer of img (the selectedText of fld tNomeFld & ".jpg") to top
show img (the selectedText of fld tNomeFld & ".jpg")
end if
...
hide img (the selectedText of fld tNomeFld & ".jpg")
a question:
if I am not wrong, is not possible to change the layer of grouped objects. is it true?
ciao
franco
Re: Image not shown
Posted: Sun Sep 28, 2014 11:45 am
by Klaus
Buongiorno Franco,
francof wrote:...if I am not wrong, is not possible to change the layer of grouped objects. is it true?
it IS possible in fact, but is also asking for trouble, because this way one can easily put a control OUT OF the group!
Check "relayer" and "relayergroupedcontrols" in the dictionary and do it at you own risk
Hint for saving a LOT OF TYPING:
When concatenating object names -> the selectedText of fld tNomeFld & ".jpg"
do this ONCE and put the contatenated name into a variable!
Code: Select all
...
## Object names in QUOTES!
put the selectedText of fld "tNomeFld" & ".jpg" into tImageName
if there is an img tImageName then
set the layer of img tImageName to top
show img tImageName
end if
...
hide img tImageName
...
Best
Klaus
Re: Image not shown
Posted: Sun Sep 28, 2014 5:40 pm
by francof
guten Abend Klaus,
thanks for the hint. I edit the script and I'll keep in mind.
Klaus wrote:
it IS possible in fact, but is also asking for trouble, because this way one can easily put a control OUT OF the group!
Check "relayer" and "relayergroupedcontrols" in the dictionary and do it at you own risk
....
NO thank you! is better than no.
below a pair of images among those that are referenced in the card and I can't put into the Image Area object

- uva tosca1.jpg (16.14 KiB) Viewed 7240 times

- cabernet franc.jpg (21.96 KiB) Viewed 7240 times
no problem for you to show them I belive.
best
franco
Edit: name of the variable in quotes return this error: " (Chunk: no such object) near "tNomeFld" "
Re: Image not shown
Posted: Sun Sep 28, 2014 7:01 pm
by Klaus
Buonasera Franco,
francof wrote:...Edit: name of the variable in quotes return this error: " (Chunk: no such object) near "tNomeFld" "
oh, sorry, I thought that was the NAME of the field and not a variable containing the name!
That's why I also wrote:
Object names in QUOTES!
Best
Klaus
Re: Image not shown
Posted: Sun Sep 28, 2014 10:08 pm
by francof
no problem, Klaus.
using the prefix 't' in the name I have not specified that it was a variable and not a field.
thanks again, ciao
franco