To All
I am trying to use local variables to create this elapsed timer. If I make the variables Static .. everything works ( as in this example ), however passing the parameters as Local by reference does not work.
If anyone wonders why I just do not use statics it is because all my modules can be opened multiple times and when I use statics the values 'bleed' between the open modules.
Any Ideas here ?
Rick Lipkin
I am trying to use local variables to create this elapsed timer. If I make the variables Static .. everything works ( as in this example ), however passing the parameters as Local by reference does not work.
If anyone wonders why I just do not use statics it is because all my modules can be opened multiple times and when I use statics the values 'bleed' between the open modules.
Any Ideas here ?
Rick Lipkin
// Testing elapsed time
#include "FiveWin.ch"
Static cTime := "000:00:00:00"
Static nSec,nMin,nHour,nDay
//-------------------
function Main()
Local oDlg, oSay1,oSay2,oSay3,oSay4,oSay5
Local oTmr
*Local nSec,nMin,nHour,nDay
nSec := 0
nMin := 0
nHour := 0
nDay := 0
oTmr := " "
DEFINE DIALOG oDlg TITLE "Test"
@ 0.5, 8 Say oSay1 PROMPT "Elapsed Seconds: "+strzero(nSec,2)
@ 1, 8 Say oSay2 PROMPT "Elapsed Minutes: "+strzero(nMin,2)
@ 1.5, 8 Say oSay3 PROMPT "Elapsed Hours : "+strzero(nHour,2)
@ 2, 8 Say oSay4 PROMPT "Elapsed Days : "+strzero(nDay,3)
@ 2.5, 8 Say oSay5 PROMPT "Elapsed Time : "+cTime
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT BuildTimer( oDlg,oSay1,oSay2,oSay3,oSay4,oSay5,@oTmr) //;
* @nSec,@nMin,@nHour,@nDay )
return nil
//-----------------
function BuildTimer( oDlg,oSay1,oSay2,oSay3,oSay4,oSay5,oTmr) //;
* nSec,nMin,nHour,nDay,oTmr )
*local oTmr
DEFINE TIMER oTmr OF oDlg ;
ACTION ( nSec++,;
If( nSec >=60,(nMin++,nSec := 0), ),;
If( nMin >=60,(nHour++,nMin := 0), ),;
If( nHour >=24,(nDay++,nHour := 0), ),;
cTime := strzero(nDay,3)+":"+strzero(nHour,2)+":"+strzero(nMin,2)+":"+strzero(nSec,2),;
oSay1:Refresh(),oSay2:ReFresh(),oSay3:ReFresh(),oSay4:ReFresh(),oSay5:ReFresh() );
INTERVAL 1000
ACTIVATE TIMER oTmr
return nil
// end