Page 1 of 1
How to put multiple images in the same row of a datagrid form
Posted: Sat Nov 04, 2017 9:28 am
by montymay
I have studied the lesson on how to put different images in a datagrid form, but the lesson uses only one image.
Code: Select all
put "Jane" into theDataA[x]["FirstName"]
put "Blue" into theDataA[x]["LastName"]
put "Secret Agent" into theDataA[x]["Title"]
put theImageFolder & "monkey.jpg" into theDataA[x]["Image URL"]
However, I have a DG form into which I want to put three different images in the each row, and each row will not necessarily have the same combination of images. If it can done, I am guessing the answer has something to do with a modification of the last line, but I can't find any discussion in the forum? If it is possible, can you give me a pointer or a code snippet? Thanks so much.
Monty May
Re: How to put multiple images in the same row of a datagrid form
Posted: Sat Nov 04, 2017 10:23 am
by Klaus
Hi Monty,
if you have three images, then you need to supply them to the datagrid:
Code: Select all
...
put "Jane" into theDataA[x]["FirstName"]
put "Blue" into theDataA[x]["LastName"]
put "Secret Agent" into theDataA[x]["Title"]
put theImageFolder & "monkey.jpg" into theDataA[x]["Image URL"]
put theImageFolder & "money.jpg" into theDataA[x]["Image URL2"]
put theImageFolder & "monk.jpg" into theDataA[x]["Image URL3"]
...
Then in the behaviour of the datagrid:
Code: Select all
on fillindata theDataArray
## Put your text into the appropriate fields
## ...
set the filename of img "image1 in datagrid" to theDataArray["Image URL"]
set the filename of img "image2 in datagrid" to theDataArray["Image URL2"]
set the filename of img "image3 in datagrid" to theDataArray["Image URL2"]
end fillindata
I hope that is what you mean.
Best
Klaus
Re: How to put multiple images in the same row of a datagrid form
Posted: Sat Nov 04, 2017 7:30 pm
by montymay
Hi Klaus
Thank you for your quick reply and the code. You understood what I meant and the code works perfectly. (Of course, the typo in the last line of the behavior script was obvious.) I've yet to understand "[Image URL]", but enlightenment will come in time.
Monty
Re: How to put multiple images in the same row of a datagrid form
Posted: Sun Nov 05, 2017 2:29 am
by Klaus
Hi Monty,
montymay wrote: ↑Sat Nov 04, 2017 7:30 pm
I've yet to understand "[Image URL]", but enlightenment will come in time.
this is
just a name for this key in the array.
Could also be like this, which makes it clearer:
...
put imgFol & "monkey.jpg" into theDataA[x]["
keyname_holding_path_to_image_file_on_disk_1"]
put imgFol & "money.jpg" into theDataA[x]["
keyname_holding_path_to_image_file_on_disk_2"]
...
Best
Klaus