Subject Re: Display Images on the form from a local imagefolder
From Ronnie MacGregor <No_Sp@m.Thanks>
Date Fri, 22 Sep 2023 18:11:03 +0100
Newsgroups dbase.getting-started

In article <5HM#17S7ZHA.1776@ip-AC1E04A7>, invalid@invalid.invalid
says...

>    function form_onOpen()
>       //Display image for first record when form opens
>       form.image2.dataSource = 'FILENAME  "'+trim(form.FISH_MB1.rowset.fields['jpg_path'].value)+'\'+form.FISH_MB1.rowset.fields['jpg_name'].value+'"'
>       return
>
>    function rowset_onNavigate(type, nRows)
>       this.parent.parent.image2.dataSource = 'FILENAME  "'+trim(this.fields['jpg_path'].value)+'\'+this.fields['jpg_name'].value+'"'
>       return

This type of thing can be difficult to keep track of when you have a
large form with lots of controls that need special handling on row
navigation.

The way I do this sort of thing is to have the custom navigation code
encapsulated in a custom control. That custom control adds itself as an
object reference to an array when it is instantiated, and then have row
navigation code that runs through the array and fires the corresponding
object navigation code for every control referenced in the array.

Sounds complex, but it is actually much simpler to maintain once you
have lots of controls with custom navigation code.