Progress Bar

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Progress Bar

Post by serge_girard »

Hello All,


When I use the progressbar for a loop during about 3 minutes the program is showing the progressbar nice but when I click another program and then click the program with the progressbar it says: '<title> (doesn't react)' and the screen turns white and shows only the hourglass.

Is there a way to make the progressbar (and the rest) visible again?

See little example:

Code: Select all

#include "hmg.ch"


DEFINE WINDOW Form_1 ;
	AT 0,0 ;
	WIDTH 400 ;
	HEIGHT 400 ;
	TITLE 'Progressbar ' ;
	MAIN  

	@ 10,10   BUTTON bt_1  CAPTION 'Progress_1' ACTION Progress_1() WIDTH 150 HEIGHT 20 FONT "Arial" SIZE 10 FLAT 

	@ 100,10 PROGRESSBAR Progress_1 ;
	RANGE 0 , 65535 		;
	WIDTH 200 			;
	HEIGHT 30 			

END WINDOW

Setproperty('Form_1','Progress_1','Visible', .F. )	
CENTER WINDOW Form_1

ACTIVATE WINDOW Form_1

RETURN

function Progress_1()	
Setproperty('Form_1','Progress_1','Visible', .T. )	
Setproperty('Form_1','Progress_1','Value', 0 )	
Setproperty('Form_1','Progress_1','RangeMax', 65535 )	

FOR A = 1 TO 65535
	Setproperty('Form_1','Progress_1','Value', A )	
	FOR B = 1 TO 10000
	NEXT B
NEXT A
RETURN
Thx,

Serge
There's nothing you can do that can't be done...
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Progress Bar

Post by esgici »

Hi Serge
serge_girard wrote: When I use the progressbar for a loop during about 3 minutes the program is showing the progressbar nice but when I click another program and then click the program with the progressbar it says: '<title> (doesn't react)' and the screen turns white and shows only the hourglass.

Is there a way to make the progressbar (and the rest) visible again?
Fortunately, yes :

Try using DO EVENTS into innermost loop :

Code: Select all

FOR A = 1 TO 65535
	Setproperty('Form_1','Progress_1','Value', A )	
	FOR B = 1 TO 10000
      DO EVENTS                           // <----      
	NEXT B
NEXT A
Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Progress Bar

Post by serge_girard »

Thx Esgici !

What does the DO EVENT actually do more?

Is it possible to start a batch and then (at the sametime) another?

Merci!


Serge
There's nothing you can do that can't be done...
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Progress Bar

Post by esgici »

Pas de quoi Serge :)
serge_girard wrote: ...What does the DO EVENT actually do more?...
It's a bit deep side of Window programming and I'm not an expert :(

As far as I understand:

- Window want periodically communicate with running programs
- If a running program ask something from OS, no problem, communication continues
- When a program running for own internal process ( such as indexing, copying large file etc ) don't ask something to OS and can't answer to Windows's requests
- When Window don't get answer or any order over a period from running program, adjudge that "this program not answer !"
- In this situation Windows don't obey some tasks previously asked by running program ( such as progress bar )
- DO EVENT command says to Windows : "I'm a bit busy; you, my slave, continue my previous order !"

I'm not sure correctness of all of this :(

Surely experts may give more adequate explications :arrow:

Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Progress Bar

Post by serge_girard »

Hello,


I noticed that with DO EVENT the function pauses for the time you do something else.

In my case I had a large batch running with DBF updates etc. (and the DO EVENT).

The DO EVENT gave me the possibility to open a new form/function which has a CLOSE ALL statement by its release.
The last release did the CLOSE ALL and the running batch terminated with an error (Alias does not exist).
So my CLOSE ALL closed really ALL.... I will have to change it into CLOSE <file>.

Thx for the explanation!

Bye, Serge
There's nothing you can do that can't be done...
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Progress Bar

Post by danielmaximiliano »

Hola Esgici :
esto es lo unico que encontre para el manejo de eventos dentro de windows.
Translate Google :
this is what I found there to handle events within windows.

http://msdn.microsoft.com/en-us/library ... vents.aspx" onclick="window.open(this.href);return false;
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Progress Bar

Post by esgici »

danielmaximiliano wrote: this is what I found there to handle events within windows.
http://msdn.microsoft.com/en-us/library ... vents.aspx" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;
Gracias Daniel :)

Viva HMG amistad :D
Viva INTERNATIONAL HMG :D
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Progress Bar

Post by danielmaximiliano »

esgici wrote:
danielmaximiliano wrote: this is what I found there to handle events within windows.
http://msdn.microsoft.com/en-us/library ... vents.aspx" onclick="window.open(this.href);return false;"
Gracias Daniel :)

Viva HMG amistad :D
Cada comentario hecho en el foro es un poco mas de conocimiento Esgici, intente buscar dentro del "Core" de harbour la funcion "Do Events" o "DoEvents()" sin ningun resultado.
cuando regrese a la tarde vere si lo encuentro mediante "TextCrawler".


Translate Google


Every comment made on the forum is a little more knowledge Esgici, try looking in the "Core" function harbor "Do Events" or "DoEvents ()" without any results.
when you return in the afternoon I'll see if I can find by "TextCrawler".
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Progress Bar

Post by esgici »

danielmaximiliano wrote: Every comment made on the forum is a little more knowledge
You are right amigo :)
try looking in the "Core" function harbor "Do Events" or "DoEvents ()" without any results.
As far as know Do Events is a HMG feature, not Harbour :?
when you return in the afternoon I'll see if I can find by "TextCrawler".
You need about two hours to noon, and here it's about three hours afternoon :lol:

Nevertheless I will wait of course :)

Viva HMG amistad :D
Viva INTERNATIONAL HMG :D
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Progress Bar

Post by danielmaximiliano »

esgici wrote:
try looking in the "Core" function harbor "Do Events" or "DoEvents ()" without any results.
As far as know Do Events is a HMG feature, not Harbour :?
Hola Esgici :
No encontre en HMG y Harbour funciones o procedimientos llamados "Events"
posiblemente este dentro de la API de Windows, posiblemente el amigo Clausio S. sepá más de este tema.

para mas referencia sobre el commando "DO"

Translate Google :

Hello Esgici:
I did not find in HMG and Harbour functions or procedures called "Events"
possibly this in Windows API, the friend Clausio S. Know more about this topic.

for more reference on the command "DO"
http://www.elektrosoft.it/tutorials/Har ... ide.htm#Do
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply