FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Right progress percentage
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Right progress percentage
Posted: Thu Jun 09, 2022 09:49 AM
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




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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Right progress percentage
Posted: Sun Jun 12, 2022 08:01 AM
hi Silvio,

my Progressbar ist alway 100%

Code (fw): Select all Collapse
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 (fw): Select all Collapse
   bBlock := { |i| FORprogress(oProgress,nEvery,i++) }
greeting,

Jimmy

Continue the discussion