Subject Re: SEARCHING VERY LARGE FILE
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Thu, 2 Sep 2021 23:15:40 +0530
Newsgroups dbase.getting-started
Attachment(s) test_search2.wfmtest_search.wfm

Good Evening Agostinho,
> I've added it to my form but it don't works and I'm getting
> the following error Class does not exist; TESTINGFORM::ENTRYFIELD_ONKEY1
> Please revise the form and help me to make it work.

I have made the necessary changes.
test_search.wfm is working.

test_search2.wfm should also work but without your table I had no way to
check it.

Hope you get better results.

Regards
Akshat



** END HEADER -- do not remove this line
//
// Generated on 02-09-2021
//
parameter bModal
local f
f = new testing2Form()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class testing2Form of FORM
   with (this)
      canClose = class::FORM_CANCLOSE
      onOpen = class::FORM_ONOPEN
      height = 23.1818
      left = 19.8889
      top = 3.68
      width = 146.5714
      text = ""
   endwith

   this.DBASESAMPLES1 = new DATABASE(this)
   with (this.DBASESAMPLES1)
      left = 66.0
      top = 3.0
      width = 11.0
      height = 1.0
      databaseName = "DBASESAMPLES"
      active = true
   endwith

   this.VERW_OUD1 = new QUERY(this)
   with (this.VERW_OUD1)
      left = 31.0
      top = 13.0
      sql = 'select * from "C:\Users\HOME_PC\Desktop\dbasetutorial\verw_oud.dbf" where lower(descript) like lower(:ag)'
      params["ag"] = "%"
      active = true
   endwith
  
   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      onKey = class::ENTRYFIELD1_ONKEY1
      height = 1.92
      left = 11.0
      top = 0.96
      width = 19.0
      value = ""
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.verw_oud1.rowset
      bgColor = "WindowText"
      height = 19.08
      left = 1.0
      top = 3.36
      width = 136.0
   endwith


   function form_canClose()
      form.timer.enabled = false
      return true

   function form_onOpen()
      _app.select2 = form
      form.twait = false
      form.timer = new timer()
      form.timer.interval = 0.75
      form.timer.ontimer = {;_app.select2.twait = false;_app.select2.timer.enabled = false; _app.select2.ENTRYFIELD1_onkey2()}
      form.timer.enabled = false
    return

    function ENTRYFIELD1_onKey1(nChar, nPosition,bShift,bControl)
       if form.twait
//       do nothing
//       We are waiting for additional key strokes
       else
         form.twait = true
         form.timer.enabled = true
       endif
       return

  

   function ENTRYFIELD1_onKey2(nChar, nPosition,bShift,bControl)
      if form.verw_oud1.params["ag"] <> "%" + rtrim(ltrim(lower(form.ENTRYFIELD1.value))) + "%"
         form.verw_oud1.params["ag"]  = "%"+rtrim(ltrim(lower(form.ENTRYFIELD1.value)))+"%"
         form.verw_oud1.requery()
         form.verw_oud1.rowset.first()
      endif
      return

endclass



** END HEADER -- do not remove this line
//
// Generated on 02-09-2021
//
parameter bModal
local f
f = new testingForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class testingForm of FORM
   with (this)
      canClose = class::FORM_CANCLOSE
      onOpen = class::FORM_ONOPEN
      height = 23.1818
      left = 19.8889
      top = 3.68
      width = 146.5714
      text = ""
   endwith

   this.DBASESAMPLES1 = new DATABASE(this)
   with (this.DBASESAMPLES1)
      left = 66.0
      top = 3.0
      width = 11.0
      height = 1.0
      databaseName = "DBASESAMPLES"
      active = true
   endwith

   this.VERW_OUD1 = new QUERY(this)
   with (this.VERW_OUD1)
      left = 52.0
      top = 2.0
      width = 8.0
      height = 1.0
      database = form.dbasesamples1
      sql = "select * from CUSTOMERS.DBF where lower(company) like lower(:ag)"
      params["ag"] = "%"
      active = true
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      onKey = class::ENTRYFIELD1_ONKEY1
      height = 1.92
      left = 11.0
      top = 0.96
      width = 19.0
      value = ""
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.verw_oud1.rowset
      bgColor = "WindowText"
      height = 19.08
      left = 1.0
      top = 3.36
      width = 136.0
   endwith


   function form_canClose()
      form.timer.enabled = false
      return true

   function form_onOpen()
      _app.select2 = form
      form.twait = false
      form.timer = new timer()
      form.timer.interval = 0.75
      form.timer.ontimer = {;_app.select2.twait = false;_app.select2.timer.enabled = false; _app.select2.ENTRYFIELD1_onkey2()}
      form.timer.enabled = false
    return

    function ENTRYFIELD1_onKey1(nChar, nPosition,bShift,bControl)
       if form.twait
//       do nothing
//       We are waiting for additional key strokes
       else
         form.twait = true
         form.timer.enabled = true
       endif
       return

  

   function ENTRYFIELD1_onKey2(nChar, nPosition,bShift,bControl)
      if form.verw_oud1.params["ag"] <> "%" + rtrim(ltrim(lower(form.ENTRYFIELD1.value))) + "%"
         form.verw_oud1.params["ag"]  = "%"+rtrim(ltrim(lower(form.ENTRYFIELD1.value)))+"%"
         form.verw_oud1.requery()
         form.verw_oud1.rowset.first()
      endif
      return

endclass