Page 1 of 1

Right progress percentage

PostPosted: Thu Jun 09, 2022 9:49 am
by Silvio.Falconi
When I make a conversion I use

local bprogress := { || ( oProgress:SetPos( npos++ ),;
SysRefresh() ) }

oProgress:SetRange( 0, (len(aData)/1000) )
oProgress:SetPos( 0 )

oLotto2:fw_ArrayToDBF( aData,,bProgress)

aData is big


Image

and the bar is immediate, that is, it immediately reaches the end but in reality the procedure is still working and still for a long time

how can I give to give the right percentage to the progress control?
I tried with oProgress:SetRange( 0, (len(aData)/2) )
it can run but the bar ends at the record 49000 approximately

Re: Right progress percentage

PostPosted: Sun Jun 12, 2022 8:01 am
by Jimmy
hi Silvio,

my Progressbar ist alway 100%

Code: Select all  Expand view
LOCAL i,nMax := len(aData)
LOCAL nEvery := INT(nMax/100)

   oProgress:SetRange( 0, 100 )
   oProgress:SetPos( 0 )

   FOR i := 1 TO nMax
      ...
      IF ( i % nEvery ) == 0
         nPos := oProgress:Value
         oProgress:SetPos( nPos++ )
      ENDIF
   NEXT


---

if you want to use a Codeblock

Code: Select all  Expand view
  bBlock := { |i| FORprogress(oProgress,nEvery,i++) }