Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Bob Brook
  Where is Bob Brook?
 Surrey
 United Kingdom
 Bob Brook
 Tags
Subject: Indicating Long Processing an alternatv
Thread ID: 288844 Message ID: 288844 # Views: 34 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Friday, December 24, 2010 2:13:22 PM         
   


How to indicate to a user that a long or extended process is taking place?

I have used the Thermometer - but unless the process is really long it just does not seem to be appropriate.
I have tended to use Wait Windows but sometimes when they stop appearing - it does not in itself indicate that the process is over - it could just be looping!

Messageboxes call for the user to click buttons - again this is not always appropriate. They might want to go to the loo or get a coffee and the processing stops at the Messagebox.

Then it suddenly occurred to me - can you call the default code for a class event; like click; more than once within the click event of the object when placed on a form. Could not see why not; so give it a go.

Created a New class based on the Commandbutton.
Added 2 new properties to it - SHOC (string - Hold Original form caption) - NHOBC (numeric - hold original Background color)

Put the following code into the click event

LPARAMETERS pcallno
DO case
	CASE m.pcallno = 1 
		this.shoc = thisform.Caption
		this.nhobc = thisform.backcolor
		thisform.Caption = "P R O C E S S I N G" + Str(m.pcallno, 6)
		thisform.backcolor = 255  &&RED
	
* added later see below	
	CASE m.pcallno > 1 and m.pcallno < 999 and 
		thisform.backcolor = thisform.backcolor  + 25 && change its colour - 16777215 being white
		thisform.Caption = "P R O C E S S I N G" + Str(m.pcallno, 6)  

* end of added later

	Otherwise
		thisform.Caption = this.shoc
		thisform.backcolor = this.nhobc
ENDCASE
thisform.refresh



Now when a form has a situation for a command button to perform a process that will take from 30secs to n minutes, I use the new class (called SV_CMDProcess) and within its click event I can code the following:

dodefault(1)

* process some data .....

dodefault(2) && change background colour

* process more data ......

dodefault(999)



During the processing the window has the title "P R O C E S S I N G" and the background colour is RED, giving a visual indication that processing is happening. When finished the original caption and colour is restored. Used with WAIT Windows it (in my opinion) gives an better/alternative way of communicating with the user.

As I type this, ideas of expanding this basic idea; to do repeated calls to dodefault() so that the background colour is changed (lightened or darkened) and the caption changed to give the progress number. Giving even more indication that events are happening to the user.

Just thought I would share this idea with you all. Hoping someone finds it useful!
Merry Christmas and New Year to you all.

Regards

Bob of Surrey, England

ENTIRE THREAD

Indicating Long Processing an alternatv Posted by Bob Brook @ 12/24/2010 2:13:22 PM