Subject Re: field type binary not working on my form
From AGOSTINHO <AGOSTINHOTEIXEIRA@YAHOO.COM>
Date Sun, 17 Sep 2023 02:43:48 -0400
Newsgroups dbase.getting-started
Attachment(s) FISH4.dbf

Dear group,
I've made a small seek_fish.form I've applied Mervyn  advice but still the same result.
when I scroll the grid the pictures display properly but as soon I type any character in the search entryfield  I will not be able to see the images anymore, the only thing I can  do is to  close the form than it will reset.
Any help how to solve this problem.
In advance thank you very much
Agostinho  

parameter bModal
local f
f = new SEEK_FISHForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class SEEK_FISHForm of FORM
   with (this)
      height = 16.0
      left = 89.4444
      top = -0.08
      width = 55.2222
      text = ""
   endwith

   this.FISH41 = new QUERY(this)
   with (this.FISH41)
      left = 25.0
      top = 4.0
      sql = 'select * from "C:\Users\HOME_PC\Desktop\dBASEtutorial\FISH4.dbf" where lower(name)  like lower(:ag)'
      params["ag"] = "%"
      active = true
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.fish41.rowset
      height = 6.16
      left = 2.3333
      top = 5.72
      width = 50.5556
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      onKey = class::ENTRYFIELD1_ONKEY
      height = 1.76
      left = 24.1111
      top = 12.76
      width = 24.1111
      value = ""
   endwith

   this.IMAGE1 = new IMAGE(this)
   with (this.IMAGE1)
      height = 3.96
      left = 4.6667
      top = 0.44
      width = 17.1111
      dataSource = form.fish41.rowset.fields["fish image"]
   endwith

   this.TEXTLABEL1 = new TEXTLABEL(this)
   with (this.TEXTLABEL1)
      height = 1.76
      left = 0.7778
      top = 12.76
      width = 18.6667
      text = "Search Fish By Name"
   endwith

   this.rowset = this.fish41.rowset

   function ENTRYFIELD1_onKey(nChar, nPosition,bShift,bControl)
       form.fish41.params['ag'] = '%'+this.value+'%'
     try
       form.fish41.requery()
    catch(exception e)
       form.fish41.requery()
   endtry
   return
      return

endclass




AGOSTINHO Wrote:

> Dear Mervyn I\\\'ve tried what you advise but I get the following at the
> Program Alert Error when searching the database.
> Error:  No CATCH for exception, class:  EXCEPTION.
> Error:  Data type mismatch.  Expecting:  Object
> The Ignore and suspend button is dimmed and I click the Fix button and it
> takes me to:
> form.products1.requery()  //it will work the second time. :-)
>
> function ENTRYFIELD4_onKey(nChar, nPosition,bShift,bControl)
>    //form.rowset.first() // This is not necessary.
>    //A requery() with the argument \\\'%...%\\\' for the LIKE predicate
>    //examines every record in the table.
>
>      form.products1.params[\\\'ag\\\'] = \\\'%\\\'+this.value+\\\'%\\\'
>    try
>      form.products1.requery()  //If it doesn\\\'t work the first time
>    catch(exception e)
> ===>     form.products1.requery()  //it will work the second time. :-)
>    endtry
>    return
>
> Please what\\\'s can I do  to avoid this error
> Thanks
> A.Teixeira
>
>
> Mervyn Bick Wrote:
>
> > On 2023/09/11 06:18, AGOSTINHO wrote:
> > > Dear group I just add a field type binary to my dbf file, I place a picture in it but when I drop the field from the field palette  to the
> > > form it work OK when moving on the grid up and down but when doing a search
> > > then I get an program alert error windows:
> > > \\\"Data type mismatch.  Expecting:  Object\\\"
> > > when click on FIX
> > >
> > > it points to form.products1.requery()
> > >
> > > function ENTRYFIELD4_onKey(nChar, nPosition,bShift,bControl)
> > >        form.rowset.first()
> > >        form.products1.params[\\\'ag\\\'] = \\\'%\\\'+this.value+\\\'%\\\'
> > > ==>  form.products1.requery()
> > >
> > > I would also like to know how do I EDIT-CHANGE-DELETE image when on the form, I don\\\'t see any option  how to program it from within the inspector.
> > > Thanks
> > > Agostinho
> >
> > It looks as if you\\\'ve caught yourself a real, live bug. :-)  If you
> > press the \\\"Ignore\\\" button and try again then it works without a problem.
> >   This makes it easy to create a work-around.
> >
> > The work-around is
> >
> > function ENTRYFIELD4_onKey(nChar, nPosition,bShift,bControl)
> >    //form.rowset.first() // This is not necessary.
> >    //A requery() with the argument \\\'%...%\\\' for the LIKE predicate
> >    //examines every record in the table.
> >
> >    form.products1.params[\\\'ag\\\'] = \\\'%\\\'+this.value+\\\'%\\\'
> >    try
> >      form.products1.requery()  //If it doesn\\\'t work the first time
> >    catch(exception e)
> >      form.products1.requery()  //it will work the second time. :-)
> >    endtry
> >    return
> >
> > To delete a picture one can\\\'t simply null the field in the table as
> > dBASE reports it as read-only.  I replace it (using replaceFromFile())
> > with a dummy picture which shows the text \\\"Picture not available\\\".  The
> > picture is attached if you care to use it.
> >
> > To change a picture simply use replaceFromFile() to save a new picture
> > to the table.
> >
> > To edit a picture one would need to export it from the table using
> > copyToFile(), edit it using an appropriate program and then use
> > replaceFromFile() to put it back into the table.
> >
> > dBASE includes Fotografix.exe in the bundle and, according to the dBASE
> > 2109 help file
> >
> > RUN(true,\\\"C:\\\\Program Files (x86)\\\\dBASE\\\\Plus12\\\\Bin\\\\fotografix.exe
> > trans.gif\\\")
> >
> > will open the program from within dBASE.  This works for me as I also
> > have dBASE Plus12 installed.
> >
> > Fotografix.exe is also included with dBASE 2109 but
> >
> > RUN(true,\\\"C:\\\\Program Files (x86)\\\\dBASE\\\\Plus2019\\\\Bin\\\\fotografix.exe
> > trans.gif\\\")
> >
> > does NOT open the program on my computer.   Right-clicking on an image
> > in the Navigator in dBASE Plus 2019 does, however, allow me to open the
> > image in Fotografix.
> >
> >
> > That 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.
> >
> > The only time I would ever consider saving images to a BLOB field in a
> > table would be for identity photos and specimen signature where, for
> > security reasons, one wouldn\\\'t want the images freely available.  Even
> > then I would only consider this if the images were stored using a SQL
> > server.  Even there it is not really necessary as access control to any
> > file, including image files, is far tighter under SQL than with the BDE.
> >
> > Mervyn.
> >
> >
> >
> >
> >
> >
> >
> >
> >
>




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