Index progress bar

HMG en Español

Moderator: Rathinagiri

trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Index progress bar

Post by trmpluym »

serge_girard wrote:Yes, I can!
S
Thanks again Serge. Tried on another pc and ..... yes it works like a charm ! So something must we wrong with the display driver on this specific computer. I will try to update the driver.

Now i am gonne try to combine my sample with the eval() function...
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: Index progress bar

Post by Carlos Britos »

Hi try moving do events to the end

For nX := 0 to 100 step 5

//////// DO EVENTS

frmProgress.Progress_1.Value := nX
frmProgress.Title := "Progress: " + Str(nX,3)+" %"

MILLISEC(1000)


DO EVENTS

Next
Regards/Saludos, Carlos (bcd12a)
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Index progress bar

Post by trmpluym »

Carlos Britos wrote:Hi try moving do events to the end

Next
I tried, same problem (on the first W7 pc). Also Serge experienced the same (wrong) behaviour on his W10 pc. Strange the progressbar seems to be pc dependant.

It does work when i use it like this:

DO EVENTS
frmProgress.Progress_1.Value := nX
MILLISEC(1000)
frmProgress.Title := "Progress: " + Str(nX,3)+" %"
cherianj
Posts: 12
Joined: Wed Feb 24, 2016 3:03 am

Re: Index progress bar

Post by cherianj »

I too have a problem related to progress bar. When I use the progress bar, it displays correctly as long as I don't do a mouse click. If I click the mouse, the bar progress stops and the title says "Not Responding". Later the process gets completed without the progress bar moving. I am new to HMG. Any help appreciated.

Cherian
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Index progress bar

Post by trmpluym »

cherianj,

Can you post sample code to demonstrate the problem ?

Theo
cherianj
Posts: 12
Joined: Wed Feb 24, 2016 3:03 am

Re: Index progress bar

Post by cherianj »

Thanks for the response. I managed to solve it by using DO EVENTS.
Regards,

Cherian
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Index progress bar

Post by trmpluym »

Pablo,

I am sorry to bother you again, but this long lasting problem is still frustrating me. If you can find the time, can you please have a look ?

The PROGRESSBAR control does not seems to update correctly on many pc's at the first and the last step, see:
2017-03-25 14_53_07-Progress_ 5.png
2017-03-25 14_53_07-Progress_ 5.png (1.22 KiB) Viewed 4223 times
2017-03-25 14_53_07-Progress_ 100.png
2017-03-25 14_53_07-Progress_ 100.png (3.08 KiB) Viewed 4223 times
Here is the updated code to reproduce the problem:

Code: Select all

#include "hmg.ch"

Function Main

DEFINE WINDOW Win_1 ;
   ROW 0 ;
   COL 0 ;
   WIDTH 640 ;
   HEIGHT 480 ;
   TITLE 'Test' ;
   WINDOWTYPE MAIN
   
DEFINE BUTTON btnAanpassen
ROW    400
COL    80
WIDTH  100
HEIGHT 28
CAPTION "Start"
ACTION StatusBar()
END BUTTON   

END WINDOW

Win_1.Center
Win_1.Activate

Return


Function StatusBar()

   DEFINE WINDOW frmProgress ;
   ROW 0 ;
   COL 0 ;
   WIDTH 355 ;
   HEIGHT 100 ;
   TITLE "Progress:" ;   
   WINDOWTYPE MODAL ;
   NOSYSMENU ;
   ONINIT StartTest()

   @ 20,20 PROGRESSBAR Progress_1 ;
     RANGE 0,100 ;                
     VALUE 0 ;
     WIDTH 300 HEIGHT 25 
   
   END WINDOW

   CENTER WINDOW frmProgress
   ACTIVATE WINDOW frmProgress
  
Return(.T.)


Function StartTest()
   
Local nX

For nX := 0 to 100 step 5
     
   DO EVENTS

   frmProgress.Progress_1.Value := nX

   frmProgress.Title := "Progress: " + Str(nX,3)+" %"      
   
   frmProgress.Progress_1.Refresh()

   DO EVENTS
             
   IF nX==5 .OR. nX==100
      MILLISEC(4000)
   ELSE 
      MILLISEC(1000)   
   ENDIF   
   
Next   

frmProgress.Release()

return(.T.)
Theo
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Index progress bar

Post by serge_girard »

Hi, Theo

On my W7-32 machine it works perfectly. On my W10-32 only 5% is not displayed. 10-100% is displayed but RETARDED (at the wrong position: 100% is displayed on position of 95%).

I changed your code a bit to slow down a bit:

Code: Select all

For nX := 0 to 100 step 5
   DO EVENTS
   frmProgress.Progress_1.Value := nX
   frmProgress.Title := "Progress: " + Str(nX,3)+" %"      
   hb_idleSleep( 1.5 )
Next   
Maybe Claudio knows why?

Serge
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Index progress bar

Post by Pablo César »

Hi Theo. It's okay.

I have tested, but I changed the timer to MILLISEC(50) and remove both DO EVENTS from you demo code.
 
Screen149.png
Screen149.png (13.87 KiB) Viewed 4200 times
 
I noted, the problem. It seems not be with timer, not with DO EVENTS but the problem "quite" always occurs mostly the time in THEMED Windows.

Try with Classic, not themed Windows and then you will see never be in fault. Strange, very strange.

In the themed Windows, never reach on time to 100%. ie. the StartTest procedure ends before 80% and the begining of ProgressBar it's also compromised at starting to show the bar just only after the 5%.

Also note that the step also was reduced to 1. With no themed Windows, wroks perfectly all the time. At least here in Win7 32bits, not themed.

Probably Serge did not noted because he tested on not themed Windows like me.
I deduce this, because I saw captured screen from Serge and noted, he probably use not themed like me.
serge_girard wrote: Sun Feb 28, 2016 9:54 am Theo,

Your PRG seems OK to me. See att.

Image
I particular like not themed. It's a little faster and safe IMO.

So, you can test your code switching thmed or not...

Probably Dr. Claudio could tell us something for this.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply