Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: How to display output in the same screen position


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: How to display output in the same screen position
Date   Fri, 28 Jun 2002 12:24:21 -0400

> -----Original Message-----
> From: S Mahmud [mailto:salah@eircom.net] 
> Sent: Friday, June 28, 2002 11:51 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: How to display output in the same screen position 
> 
> Dear all,
> 
> I was wondering if there is any way to display output in the 
> same screen
> position (same x and y coordinate).  I want to output the 
> record number to
> the same screen spot to give the illusion of a progress 
> counter during a
> lengthy process.
> 
> Regards,
> 
> Salah

There is, as far as I know, no way to do this in Stata's usual output
window.  There is no way to make Stata "back up" in the window.  You can
do this, after a fashion, with the -window control- commands.

The following is a simple example; see the programming manual for
-window control- for much more.

****** BEGINNING OF myprog.ado **********************
program define myprog

	window control clear
	window control button "Do It" 10 10 30 18 DB_doit
	window control button "Cancel" 50 10 30 18 DB_ca
	window control static DB_text 10 50 50 20
	global DB_doit "DoIt"
	global DB_ca "exit 3000"
	global DB_text " "
	capture window dialog "Sample dialog" . . 140 100
	
end

program define DoIt
forval i=1/10 {
*
* DO TASK HERE 
*
	forval j=1/10000 { }

	global DB_text "Counter Value: `i'"
	window dialog update
}
exit 3000

end

**** END OF myprog.ado ******************************
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index