Subject Re: How to flash a message without waiting
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 6 Nov 2021 11:56:29 +0200
Newsgroups dbase.getting-started
Attachment(s) show_progress.wfm

On 2021/11/06 08:16, Milind Nighojkar wrote:
> Hi Ken,
> Apologies for late reply..
>
> I did not get the answer ....I am looking for a solution using progress bar component...
>
> Any advise
>
> Regards

An example form using a progress bar is attached.  The example also
shows how to show a message while the process is running.

Mervyn.



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

class show_progressForm of FORM
   with (this)
      height = 16.0
      left = 70.0
      top = 0.0
      width = 40.0
      text = ""
   endwith

   this.SAMPLES1 = new DATABASE(this)
   with (this.SAMPLES1)
      width = 6.0
      height = 1.0
      databaseName = "DBASESAMPLES"
      active = true
   endwith

   this.EMPLOYEES1 = new QUERY(this)
   with (this.EMPLOYEES1)
      left = 7.0
      width = 8.0
      height = 1.0
      database = form.samples1
      sql = "select * from EMPLOYEES.DBF"
      active = true
   endwith

   this.PROGRESS1 = new PROGRESS(this)
   with (this.PROGRESS1)
      height = 1.0
      left = 5.7143
      top = 11.0909
      width = 28.4286
      value = 0
      rangeMin = 0
      rangeMax = 100
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 12.1429
      top = 8.3636
      width = 15.2857
      text = "Process table"
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      dataLink = form.employees1.rowset.fields["lastname"]
      height = 1.0
      left = 8.4286
      top = 4.3636
      width = 20.0
   endwith

   this.TEXTLABEL1 = new TEXTLABEL(this)
   with (this.TEXTLABEL1)
      height = 1.0
      left = 2.5714
      top = 13.5455
      width = 36.0
      text = ""
   endwith


   function PUSHBUTTON1_onClick()
      _app.allowYieldOnMsg = true
      form.textlabel1.text = ''
      form.employees1.rowset.first()
      nRecords = form.employees1.rowset.count()
      nPercent = 0
      nCount = 1
      do while not form.employees1.rowset.endofset
          _app.executeMessages()
          nPercent = int(nCount/nRecords*100)
          form.progress1.value = nPercent
          form.textlabel1.text = nCount+ '  records processed.'
          inkey(0.2)
          form.employees1.rowset.next()
          nCount ++          
      enddo
      form.textlabel1.text += '  Process complete'      
      return

  

endclass