Silvio.Falconi wrote:opps sorry
but I wish show the seconds
your code
..........
nSecs := 20 // The seconds u wuant to wait.
MsgMeter( { | oMeter, oText | CountDown( nSecs, oMeter, oText ) }, " " + allTrim( str( nSecs ) ) + " SECONDS", "PLEASE WAIT..." )
........
your code
FUNCTION CountDown( nSecs, oMeter, oText )
LOCAL nI := 0
oMeter:nTotal := nSecs
oMeter:Set( nSecs )
WHILE nI < nSecs
WaitSeconds( 1 )
nI ++
oText:VarPut( " " + allTrim( str( nSecs - nI ) ) + " SECONDS" )
oText:Refresh()
oMeter:Set( nSecs - nI )
ENDDO
RETURN NIL
#include "Fivewin.ch"
#include "constant.ch"
#define LIGHTCYAN nRGB( 203, 225, 252 )
FUNCTION TEST()
MsgRun( " NagScreen title",;
"Processando, aguarde...",;
{ | oDlgSef | UpdCaption( oDlgSef) } )
RETURN NIL
Static function MsgRun( cCaption, cTitle, bAction )
Local oDlg,oProgress
Local nBottom := 26.9
Local nRight := 66
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
DEFAULT cCaption := "Per favore, attendi",;
bAction := { || WaitSeconds( 1 ) }
DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8
DEFINE DIALOG oDlg ;
TITLE cCaption ;
SIZE nWidth, nHeight TRANSPARENT PIXEL ;
GRADIENT { { 1,CLR_WHITE, LIGHTCYAN } } ;
FONT oFont
oProgress := TProgress():New( 2.8, 1, oDlg, , , , .f.,, 250, 10, , .f., .f. )
oDlg:bStart := { || uReturn := Eval( bAction, oDlg ), oDlg:End(), SysRefresh() }
oDlg:cMsg := cCaption
ACTIVATE DIALOG oDlg CENTER ;
ON PAINT (TrayTimer( oDlg, 80, oProgress ),;
oDlg:Say( 11, 0, xPadC( oDlg:cMsg, nWidth ),,,, .T., .T. ) )
return nil
//----------------------------------------------------------------------------//
Static function WaitSeconds( nSecs )
local nStart := GetTickCount()
DEFAULT nSecs := 1
while GetTickCount() - nStart < ( 1000 * nSecs )
end
return nil
//----------------------------------------------------------------------------//
Static function MsgWait( cCaption, cTitle, nSeconds )
DEFAULT nSeconds := 4
return MsgRun( cCaption, cTitle, { || WaitSeconds( nSeconds ) } )
//----------------------------------------------------------------------------//
Static function StopUntil( bBlock )
DO WHILE !Eval( bBlock )
WaitMessage()
SysRefresh()
ENDDO
Return NIL
//----------------------------------------------------------------------------//
Static function TrayTimer( DlgT, nInterval, oMet )
LOCAL oTmr
DEFINE TIMER oTmr OF DlgT INTERVAL 1 ;
ACTION ( oMet:nPosition +=1, IIF(oMet:nPosition > nInterval, DlgT:End(), Msgbeep() ) )
ACTIVATE TIMER oTmr
RETURN nil
//-------------------------------------------------------------------------//
Static function UpdCaption( oDlg )
local nFor, nStart
for nFor := 20 to 0 step -1
nStart = GetTickCount()
while ( GetTickCount() - nStart ) < 1000
end
oDlg:cMsg := " attendi per "+;
LTrim( Str( nFor ) ) + " second" + ;
If( nFor > 1, "i", "o" )
oDlg:Refresh()
SysRefresh()
next
return nil
//-------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 85 guests