----------------------------------------------------------------------------------------------------
Armitage Technologies Ltd.
Details of D:\ckhung\cw7\CW.PBL(w_progress)
----------------------------------------------------------------------------------------------------

[Window] w_progress from Window
[Description] * display a progress bar and <cancel> button for long process

Size (*.srw): 3,969		Updated on 13-Jun-1999 19:41


[CONTROL]

TYPE	NAME	REMARKS
Window	<w_progress>	Type=popup!; Title="Process in progress, please wait..."; 
commandbutton	cb_cancel	Tab=2; Text="&Cancel"; 
u_progress_bar	dw_pct	
statictext	st_msg	Disable; Text="Percentage of progress"; 


[VARIABLES]

TYPE	DECLARATION
Instance Variable	// percentage of progress
Instance Variable	decimal  id_progress
Instance Variable	boolean ib_continue = TRUE


[SCRIPT LIST]

CONTROL	TYPE	NAME	BYTES	LINE
 w_progress	Event	open	926	31
 w_progress	PublicFunc	wf_progress (decimal ad_progress) return boolean	167	9
 w_progress	PublicFunc	wf_progress (decimal ad_progress, string as_text) return boolean	190	10
 w_progress	PublicProc	wf_setmsg (string as_text)	57	3
 w_progress	PublicProc	wf_settitle (string as_title)	50	3
cb_cancel	ControlEvent	clicked	147	4
		total	1537	60

[SCRIPT DETAILS]

----------------------------------------------------------------------------------------------------
Event   w_progress.open
----------------------------------------------------------------------------------------------------
1:	//$ Desription:
2:	//$   This window is used to display a progress bar with <cancel> button> for long
3:	//$   process.
4:	//$
5:	//$ Functions:
6:	//$   wf_settitle()         set the window title
7:	//$   wf_setmsg()            set the display message
8:	//$   wf_progress()         display the current progress
9:	//$   
10:	//$ Example:
11:	//$   long i, j, l
12:	//$   open(w_progress)
13:	//$   for i = 1 to 100
14:	//$      for j=1 to 100
15:	//$      next
16:	//$      if not w_progress.wf_progress( i / 100, 'processing '+string(i) ) then exit
17:	//$   next
18:	//$   close(w_progress)
19:	//$
20:	//$ Log:
21:	//$   1997/12/29   C.K. Hung   Initial Version
22:	//$--------------------------------------------------------------------------------------
23:	//$ Copyright (c) 1997, C.K. Hung, All rights reserved. (http://www.intercon.net/~ckhung/)
24:	//$======================================================================================
25:	
26:	// set bar style
27:	dw_pct.of_setstyle(1)
28:	
29:	// init flag app.ib_cancel
30:	app.ib_cancel = FALSE
31:	

----------------------------------------------------------------------------------------------------
PublicFunc  wf_progress (decimal ad_progress) return boolean
----------------------------------------------------------------------------------------------------
1:	// display percentage
2:	dw_pct.of_progress(ad_progress)
3:	
4:	// handle outstanding message
5:	do while yield()
6:	loop
7:	
8:	// return the flag of "continue"
9:	return ib_continue

----------------------------------------------------------------------------------------------------
PublicFunc  wf_progress (decimal ad_progress, string as_text) return boolean
----------------------------------------------------------------------------------------------------
1:	// display percentage
2:	st_msg.text = as_text
3:	dw_pct.of_progress(ad_progress)
4:	
5:	// handle outstanding message
6:	do while yield()
7:	loop
8:	
9:	// return the flag of "continue"
10:	return ib_continue

----------------------------------------------------------------------------------------------------
PublicProc  wf_setmsg (string as_text)
----------------------------------------------------------------------------------------------------
1:	// Set the display message
2:	st_msg.text = as_text
3:	return

----------------------------------------------------------------------------------------------------
PublicProc  wf_settitle (string as_title)
----------------------------------------------------------------------------------------------------
1:	// set window title
2:	this.title = as_title
3:	return

----------------------------------------------------------------------------------------------------
CotrolEvent  cb_cancel.clicked
----------------------------------------------------------------------------------------------------
1:	if messagebox( 'CANCEL?', 'Are you sure to abort this process?', STOPSIGN!, YesNo! ) = 1 then
2:	   ib_continue = FALSE
3:	   app.ib_cancel = TRUE   
4:	end if

----------------------------------------------------------------------------------------------------
CasualWriter - w_progress                                                          07-Feb-2003 21:09


