Welcome! Log In Create A New Profile

Advanced

WD12: How to insert images on a table cells

Posted by Gianni Spano 
Gianni Spano
WD12: How to insert images on a table cells
February 07, 2009 08:50PM
Hello to all

It should be a dummy question, but i didn't find anything on the online help to solve this little trouble.
I have a table with 33 columns (the 1st two columns are text type and the remains cols are declared as "Image".
I would like to emulate the "checkbox" in each cell (from 3 to 33) and i want to insert a little image that shows a checked symbol or any other little image i would want.

The "checked symbol" must be shown only if certains data read from my database satisfy my needed otherwise the image must be blank.

Now i'm using this portion of code:

TableAdd (Table_Pazienti,pazienti.paz_code+tab+pazienti.paz_name)

then i start a loop to check the remaining columns

for j=1 to 31
k=j+2

if pazienti.paz_check[[j]]="1" //this field contains 31 characters like a month
{"Table_Pazienti.COL_Column"+k}..image="pathname_of_checked_symbol"
else
{"Table_Pazienti.COL_Column"+k}..image="pathname_of_blank_symbol"
end

I have an error when WD tries to execute the code..

What am i doing wrong??
Any help is very appreciated.

Thanks in advance
Gianni


Gianni Spano
Re: WD12: How to insert images on a table cells
February 08, 2009 09:17PM
Problem solved!!

For your information, each cell that must contains an image, must be declared as a "text" type, then you can pass the full pathname of the image, like:

Table_table1.COL_Column1=gImage(pathname_of_the_image)

"gImage" declaration did the trick.

Gianni

Just thought you might me interested in this:

I find it simpler to add a hidden image control. So for example if the image control is called IMG_TICK then all I need to do is:

TBL_DATA.COL_Column1 = IMG_TICK

That way the image is in memory ready for me to use rather than you having to remember to include an image file with the installation.

Jonathan
Web: [www.funcoder.com]
Twitter: funcoder
Gianni Spano
Re: WD12: How to insert images on a table cells
February 09, 2009 09:29AM
Hi Jonathan

Yes, my final solution was exactly to add an image control in the form and then apply the same way you did.

Gianni
Arie
Re: WD12: How to insert images on a table cells
February 09, 2009 09:34AM
You can also add those images as "other" in the project explorer. This way they are added to your executable and you don't need a (or several) image control(s) nor do you have to include them in the setup. They can be referenced then, just by name.

Arie
Ooo

I didn't know that adding images to Other would include them in the EXE. You learn something new every day smiling smiley

Thanks Arie.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: