Image control with dynamically associated image
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
Image control with dynamically associated image
Hello everyone.
I do not know if it can be done, but I would like to set it dynamically depending on some criteria.
I already imported the images into the stack and automatically livecode created as many image controls as the imported images.
What I would like to understand is:
1 - Can I import images into the stack without creating an image control for each of them?
2 - Can I use a single image control to associate the image that matches the criteria I provide?
Thank you
I do not know if it can be done, but I would like to set it dynamically depending on some criteria.
I already imported the images into the stack and automatically livecode created as many image controls as the imported images.
What I would like to understand is:
1 - Can I import images into the stack without creating an image control for each of them?
2 - Can I use a single image control to associate the image that matches the criteria I provide?
Thank you
Re: Image control with dynamically associated image
Buonasera Allessio,
But I would recommend to use a button object where you just set the ICON to the id of an image you want to display, no need for fiddling around with putting images into images etc.
Best
Klaus
no, once an image is in LC it becomes an image object.1 - Can I import images into the stack without creating an image control for each of them?
Yes, sure, you can always do something like -> put img 1 into img 22 - Can I use a single image control to associate the image that matches the criteria I provide?
But I would recommend to use a button object where you just set the ICON to the id of an image you want to display, no need for fiddling around with putting images into images etc.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Image control with dynamically associated image
Klaus,Klaus wrote:no, once an image is in LC it becomes an image object.
he possibly wants to load images from file into a variable or custom property and then set from there the text of img "onlyimage"?
shiftLock happens
Re: Image control with dynamically associated image
Maybe?
Your message contains 9 characters.
You need to enter at least 10 characters.
Your message contains 9 characters.
You need to enter at least 10 characters.
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Image control with dynamically associated image
Hi Alessio,
You can also use filename to display an image.
This script get a llist of imgs in a folder and display them in one image with a wait time between each image.You can also use filename to display an image.
This script get a llist of imgs in a folder and display them in one image with a wait time between each image.
Image proportional resizing will be probably the next step
Best regards
Jean-Marc
You can also use filename to display an image.
This script get a llist of imgs in a folder and display them in one image with a wait time between each image.You can also use filename to display an image.
This script get a llist of imgs in a folder and display them in one image with a wait time between each image.
Image proportional resizing will be probably the next step
Code: Select all
on debChooseFolder
answer folder "Choose a folder"
if it = empty then exit debChooseFolder
put it into tPathFol
put getImgFiles(tPathFol) into tAllPathImg
repeat for each line tPathImg in tAllPathImg
put tPathFol & "/" & tPathImg into tPathFile
set the filename of img 1 to tPathFile
wait 300 milliseconds
end repeat
end debChooseFolder
function getImgFiles pPathFol -- return a list of imgs .png and .jpg in a folder
put ".png,.jpg" into tTheExt
set the folder to pPathFol
put the files into tFiles
put empty into rgetImgFiles
repeat for each line tPath in tFiles
if char -4 to -1 of tPath is in tTheExt then
put tPath & cr after rgetImgFiles
end if
end repeat
delete char -1 of rgetImgFiles
return rgetImgFiles
end getImgFiles
Jean-Marc
https://alternatic.ch
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
Re: Image control with dynamically associated image
Thank you all for your help.
With the information you have provided me I will be able to do what I have in mind.
With the information you have provided me I will be able to do what I have in mind.
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
Re: Image control with dynamically associated image
Mm ... what I do not do is extract the name of iimagine as I flow through the cycle for each.
The image name will be the criterion for choosing or discarding it.
The names of the images are 1.png 2.png 3.png ... ... ...
The image name will be the criterion for choosing or discarding it.
The names of the images are 1.png 2.png 3.png ... ... ...