Subject Re: Closing an image on a form
From roy price <royprice@royprice.name>
Date Fri, 09 Apr 2021 02:33:22 -0400
Newsgroups dbase.getting-started

Mervyn Bick Wrote:

> On 2021/04/07 15:12, Mervyn Bick wrote:
>
> > I'm taking a break now to watch the rest of the ODI cricket match
> > between Pakistan and South Africa but I'll give you some code tomorrow.
> > Unless someone else does so first. :-)
>
> What a waste of good computing time that turned out to be.  South Africa
> played badly and was thoroughly beaten by Pakistan. :-(
>
> In the following event handler for
> form.cactusadatamodule1.cactusaa_dbf1.rowset
>
>      this is form.cactusadatamodule1.cactusaa_dbf1.rowset
>      this.parent is form.cactusadatamodule1.cactusaa_dbf1
>      this.parent.parent is form.cactusadatamodule1
>      this.parent.parent.parent is form
>
> With your form open in the designer select the main table's rowset in
> the dropdown list.  Select the Events tab and then select the onNavigate
> event.  Click on the "spanner" button to create the skeleton for the
> event handler and then use the code in one of the following event
> handlers.  Although I've been over it fairly carefully the code is
> untested so it may have problems.  If you can't sort them out yourself
> post the error messages.
>
> With three image controls on the form
>
>     function rowset_onNavigate(type, nRows)
>        if this.fields['photoyesfile'].value = '01'
>          //add code here to navigate to correct record in photos01_dbf1
>          this.parent.parent.parent.imagephoto01.datasource =
> this.parent.parent.photos01_dbf1.rowset.fields["photo"]
>          this.parent.parent.parent.imagephoto02.datasource = []
>          this.parent.parent.parent.imagephoto03.datasource = []
>        elseif this.fields['photoyesfile'].value = '02'
>           //add code here to navigate to correct record in photos02_dbf1
>          this.parent.parent.parent.imagephoto02.datasource =
> this.parent.parent.photos02_dbf1.rowset.fields["photo"]
>          this.parent.parent.parent.imagephoto01.datasource = []
>          this.parent.parent.parent.imagephoto03.datasource = []
>        elseif this.fields['photoyesfile'].value = '03'
>          //add code here to navigate to correct record in photos03_dbf1
>          this.parent.parent.parent.imagephoto03.datasource =
> this.parent.parent.photos03_dbf1.rowset.fields["photo"]
>          this.parent.parent.parent.imagephoto01.datasource = []
>          this.parent.parent.parent.imagephoto02.datasource = []
>        endif
>        return
>
> With one image control on the form
>
>     function rowset_onNavigate(type, nRows)
>        if this.fields['photoyesfile'].value = '01'
>          //add code here to navigate to correct record in photos01_dbf1
>          this.parent.parent.parent.imagephoto01.datasource =
> this.parent.parent.photos01_dbf1.rowset.fields["photo"]
>        elseif this.fields['photoyesfile'].value = '02'
>         //add code here to navigate to correct record in photos02_dbf1
>          this.parent.parent.parent.imagephoto01.datasource =
> this.parent.parent.photos02_dbf1.rowset.fields["photo"]
>        elseif this.fields['photoyesfile'].value = '03'
>         //add code here to navigate to correct record in photos03_dbf1
>          this.parent.parent.parent.imagephoto01.datasource =
> this.parent.parent.photos03_dbf1.rowset.fields["photo"]
>        endif
>        return
>
>
>
> Mervyn.
>
> Hello Mervyn,
Thanks for your help
I'm setting up a test directory with the minimal  number of files to get the navigation to the three image files to work.
However, I don't understand where to add this.....
  " In the following event handler for
> form.cactusadatamodule1.cactusaa_dbf1.rowset
>
>      this is form.cactusadatamodule1.cactusaa_dbf1.rowset
>      this.parent is form.cactusadatamodule1.cactusaa_dbf1
>      this.parent.parent is form.cactusadatamodule1
>      this.parent.parent.parent is form"

As an aside I was a constant user of dbase in the 1990's-2000's. But having been retired long since, I struggle to remember what I have forgotten.
(I hope Pakistan bowlers don't use sandpaper!)