Bug in TProgress [Fixed]

Bug in TProgress [Fixed]

Postby Enrico Maria Giordano » Tue May 16, 2017 10:30 am

Please try the following sample without and with manifest file. Without manifest file it works fine (the bar is filled) while with manifest file the bar is empty. Any workaround?

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oPrg

    DEFINE DIALOG oDlg;
           SIZE 800, 600

    @ 1, 1 PROGRESS oPrg

    ACTIVATE DIALOG oDlg;
             ON INIT ( oPrg:SetRange( 0, 10 ),;
                       oPrg:SetPos( 10 ) );
             CENTER

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Re: Bug in TProgress

Postby Antonio Linares » Thu May 18, 2017 2:13 pm

Enrico,

It is a known bug when using a manifest file with progress bars

Please review samples\progres1.prg to see how to workaround it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in TProgress

Postby Enrico Maria Giordano » Thu May 18, 2017 2:49 pm

Ok. :-(

I don't see any valid workaround in progres1.prg... :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TProgress

Postby Enrico Maria Giordano » Fri May 19, 2017 10:29 am

This is a possible workaround:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, oProg1, oProg2
   
   DEFINE DIALOG oDlg TITLE "Progress Bars"
   
   @ 1, 1 PROGRESS oProg1 SIZE 80, 12

   @ 1, 20 PROGRESS oProg2 SIZE 12, 50 VERTICAL
   
   @ 3,  9 BUTTON "Ok" ACTION oDlg:End()
   
   oDlg:bStart = { || Increase( oProg1, oProg2 ) }
   
   ACTIVATE DIALOG oDlg CENTER ;
      ON INIT ( oProg1:SetRange( 0, 100 ),;
                oProg2:SetRange( 0, 100 ) )
   
return nil  

function Increase( oProg1, oProg2 )

   local n

   for n = 1 to 100
      if n < oProg1:nMax
         oProg1:SetPos( n + 1 )
         oProg1:SetPos( n )
      else
         oProg1:SetRange( oProg1:nMin, oProg1:nMax + 1 )
         oProg1:SetPos( oProg1:nMax )
         oProg1:SetRange( oProg1:nMin, oProg1:nMax - 1 )
         oProg1:SetPos( oProg1:nMax )
      endif

      if n < oProg2:nMax
         oProg2:SetPos( n + 1 )
         oProg2:SetPos( n )
      else
         oProg2:SetRange( oProg2:nMin, oProg2:nMax + 1 )
         oProg2:SetPos( oProg2:nMax )
         oProg2:SetRange( oProg2:nMin, oProg2:nMax - 1 )
         oProg2:SetPos( oProg2:nMax )
      endif

      SysWait( 0.02 )
   next
   
return nil


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TProgress

Postby Antonio Linares » Fri May 19, 2017 10:40 am

When I run progres1.prg, the progress bars get complete full
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in TProgress

Postby Enrico Maria Giordano » Fri May 19, 2017 11:05 am

Yes, but only if you use a range 0 -116, that is not what we want.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TProgress

Postby Enrico Maria Giordano » Fri May 19, 2017 11:08 am

My workaroud works with any range (I hope). The previous was with 0-100, this is with 0-10:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, oProg1, oProg2
   
   DEFINE DIALOG oDlg TITLE "Progress Bars"
   
   @ 1, 1 PROGRESS oProg1 SIZE 80, 12

   @ 1, 20 PROGRESS oProg2 SIZE 12, 50 VERTICAL
   
   @ 3,  9 BUTTON "Ok" ACTION oDlg:End()
   
   oDlg:bStart = { || Increase( oProg1, oProg2 ) }
   
   ACTIVATE DIALOG oDlg CENTER ;
      ON INIT ( oProg1:SetRange( 0, 10 ),;
                oProg2:SetRange( 0, 10 ) )
   
return nil  

function Increase( oProg1, oProg2 )

   local n

   for n = 1 to 10
      if n < oProg1:nMax
         oProg1:SetPos( n + 1 )
         oProg1:SetPos( n )
      else
         oProg1:SetRange( oProg1:nMin, oProg1:nMax + 1 )
         oProg1:SetPos( oProg1:nMax )
         oProg1:SetRange( oProg1:nMin, oProg1:nMax - 1 )
         oProg1:SetPos( oProg1:nMax )
      endif

      if n < oProg2:nMax
         oProg2:SetPos( n + 1 )
         oProg2:SetPos( n )
      else
         oProg2:SetRange( oProg2:nMin, oProg2:nMax + 1 )
         oProg2:SetPos( oProg2:nMax )
         oProg2:SetRange( oProg2:nMin, oProg2:nMax - 1 )
         oProg2:SetPos( oProg2:nMax )
      endif

      SysWait( 1.02 )
   next
   
return nil


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TProgress

Postby Antonio Linares » Fri May 19, 2017 7:02 pm

very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 4 guests