I'm trying to display an image on a card programatically/at run-time... (say, the picture of a particular person from a list of people) . Sounds simple enough... and, to be fair, I have sorted out how to do this if I use an Image control (imgImage).
Code: Select all
local N, sFile
put [1 | 2 | 3 | 4] into N ##simply makes this demo code easier. There are various images in the Images folder all referenced as 'Image-1.jpg', 'Image-2.jpg', 'Image-3.jpg' etc...)
put specialfolderpath("Documents") & "/Images/image-" & N & ".jpg" into sFile
if there is a file sFile then
set the filename of image "imgImage" to sFile
else
//do something else / warn of missing file...
end if
Ideally, I'd like to 'fix' the image 'holder' / LC control size so that ANY image I select is ALWAYS displayed the same size. ie. the 'Image' control should NOT resize to the size of the loaded image - the source image should expand / contract to fit the container / Image control. Naturally, I'd still like to be able to resize my card at which point the image in it should re-size itself proportionally and accordingly...
Have I missed some properties here ? If so, where, which ones please ?
Additionally and because I've been struggling (again), I've been 'playing' with Button controls. I'd also like to be able to set the icon / image ofa Button control (btnImage). Again, programatically / at run-time - much the same as per the Image Control. To do this I think the code should go a little like :
Code: Select all
set the filename of button "btnImage" to sFile

Ideas on one or both counts please ?
Many thanks