Subject |
Re: Display Images on the form from a local imagefolder |
From |
Lee Grant <camilee@nospam.comcast.net> |
Date |
Fri, 22 Sep 2023 02:38:08 -0400 |
Newsgroups |
dbase.getting-started |
Agostinho,
I'm not sure what you're after, and Akshat's code seems kind of complex
for a simple image control display. The code I use, depends on the
rowset that controls the database, and as it moves via those mechanisms,
so does the image that goes along with that rowset and the field that
references the image folder you're pointing to, which is how I use it
for my tool inventory program that has a picture of the tool being
documented and displays it when the record is selected...using this code
for the image control:
this.TOOL_PIC_IMG = new IMAGE(this)
with (this.TOOL_PIC_IMG)
height = 187.0
left = 959.0
top = 33.0
width = 252.0
dataSource = form.tools1.rowset.fields["tool_pic"]
mousePointer = 12 // No
endwith
There is no on_Navigate needed for this, since as the controlling rowset
moves, so does the image. This image control just needs to point to the
field in the rowset that pertains to it, that holds the reference link
to the appropriate image that you want displayed.
Between this and Akshats code, you should have an idea of what you need
to do. Remember, you're using a datasource, not a datalink...the rowset
provides the link and reference, the datasource just allows for the
picture to be referenced from the link in the database's rowset.
Lee
On 9/22/2023 12:13 AM, AGOSTINHO wrote:
> Following Mervin Bick adive that's not recommended to save images to tables.
>
>>>> Mervin Bick advice:
>>>> "hat said, just because dBASE allows you to do something doesn't mean
>>>> you should. There is a school of thought that holds that one shouldn't
>>>> save images in a table. One should rather keep all images in a folder
>>>> and save the image name, including the path, to a text field in the
>>>> table. One can use the rowset's onNavigate event handler to display the
>>>> image in an image control on the form as the user steps through the table."
>
> I've been trying to use images from my computer directory location but
> can't get it to work.
>
> I added a character field named "imagefolder" to my fish4.dbf file and wrote the image files name to this particular record "C:\Users\HOME_PC\Desktop\blueangelfish.png"
>
> Dropped an image controle from the componed pallete to the form
> and have programmed an onNavigate function into the form.
>
> this.IMAGE1 = new IMAGE(this)
> with (this.IMAGE1)
> height = 4.84
> left = 73.1111
> top = 3.96
> width = 17.8889
> endwith
>
> function form_onNavigate(nWorkArea)
> local cImageFileName
> // Assuming I have a field in my table that contains image file paths
> cImageFileName = form.fish41.rowset.fields["imagefolder"]
> // Image control's ImageFile property to display the image
> this.image1 = cImageFileName
> return
>
> Thanks
> Agostinho
>
|
|