Subject Re: Closing an image on a form
From roy price <royprice@royprice.name>
Date Sat, 10 Apr 2021 18:29:13 -0400
Newsgroups dbase.getting-started

roy price Wrote:

> 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 Again Mervyn / Akshat,
> After setting up a test area, with three records on the main table, each with a field "Photoyesfile" "01", "02", "03", and three image files (with one image each), and trying (very trying) the code below in various combinations, I get nowhere with selecting the second and third files images.
> The If's or Cases statements work to get to the correct line, but the statements, "this.dataSource =", or "form.testimagedatamodule1.dataSource =" do not cause the first image  to be replaced with the second, or third.
>
>  this.IMAGEPHOTO1 = new IMAGE(this)
>    with (this.IMAGEPHOTO1)
>       onOpen = class::IMAGEPHOTO1_ONOPEN
>       height = 19.0
>       left = 4.0
>       top = 8.5
>       width = 78.0
>       dataSource = form.testimagedatamodule1.photos01_dbf1.rowset.fields["photo"]
>       enabled = true
>    endwith
>
>    this.rowset = this.testimagedatamodule1.cactusdb_dbf1.rowset
>
>  function IMAGEPHOTO1_onOpen()
>        mphoto = form.testimagedatamodule1.cactusdb_dbf1.rowset.fields["photoyesfile"].value
>                 
>      If mPhoto='01'
>            this.dataSource =  form.testimagedatamodule1.photos01_dbf1.rowset.fields["photo"]
>      elseif mPhoto='02'
>       this.dataSource =  form.testimagedatamodule1.photos02_dbf1.rowset.fields["photo"]
>      elseif mPhoto='03'
>            this.dataSource =  form.testimagedatamodule1.photos03_dbf1.rowset.fields["photo"]
>      endif
>    return
>       return
>
>    function form_onNavigate()
>            mphoto = form.testimagedatamodule1.cactusdb_dbf1.rowset.fields["photoyesfile"].value
>                 do case
>                 case mphoto = '01'
>                    //add code here to navigate to correct record in photos01_dbf1
>         form.testimagedatamodule1.dataSource =  form.testimagedatamodule1.photos01_dbf1.rowset.fields["photo"]
>       case mphoto= '02'
>                   //add code here to navigate to correct record in photos02_dbf1
>          form.testimagedatamodule1.dataSource =  form.testimagedatamodule1.photos02_dbf1.rowset.fields["photo"]
>       case mPhoto = '03'
>                   //add code here to navigate to correct record in photos03_dbf1
>          form.testimagedatamodule1.dataSource =  form.testimagedatamodule1.photos03_dbf1.rowset.fields["photo"]
>       endcase
>       return
>
>    function form_onOpen1()
>        mphoto = form.testimagedatamodule1.cactusdb_dbf1.rowset.fields["photoyesfile"].value
>                 
>      If mPhoto='01'
>            this.dataSource =  form.testimagedatamodule1.photos01_dbf1.rowset.fields["photo"]
>      elseif mPhoto='02'
>       this.dataSource =  form.testimagedatamodule1.photos02_dbf1.rowset.fields["photo"]
>      elseif mPhoto='03'
>            this.dataSource =  form.testimagedatamodule1.photos03_dbf1.rowset.fields["photo"]
>      endif
>    return
>       return
>
> I also tried the Parent.parent.parent suggestion. without success. (Variable undefined:  PARENT) error



Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0