Subject Re: Display Images on the form from a local imagefolder
From Mervyn Bick <invalid@invalid.invalid>
Date Fri, 22 Sep 2023 11:07:41 +0200
Newsgroups dbase.getting-started

On 2023/09/22 08:38, Lee Grant wrote:
> 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.

This is the way to display images stored in a BLOB field in a table.
Agostinho actually has this working and what he now wants to do is
display images held in discreet image files such as .jpg files.  To do
this the syntax is

     dataSource = 'FILENAME "whatever.jpg"'

The only way to achieve this is to use the rowset's onNavigate event
handler to assign a new value to the image's dataSource property every
time the rowpointer moves.  The code is a bit "messier" than when one
uses images saved in a BLOB field but once it's done it's done.  :-)