Page 1 of 1

Nag Screen

Posted: Fri Sep 20, 2013 7:09 am
by Silvio.Falconi
Someone have a mall sample of Nag-screen for a wait time of 20 seconds ? thanks

Re: Nag Screen

Posted: Fri Sep 20, 2013 10:38 am
by Antonio Linares
Silvio,

function MsgWait( cMsg, cTitle, 20 )

Re: Nag Screen

Posted: Fri Sep 20, 2013 10:57 am
by Silvio.Falconi
opps sorry
but I wish show the seconds

Re: Nag Screen

Posted: Fri Sep 20, 2013 12:34 pm
by Wanderson
Silvio.Falconi wrote:opps sorry
but I wish show the seconds
Hi Silvio, I use this to 5 seconds, but you can change to other value (nFor)


MsgRun( " Aguardando resposta da entidade receptora em 5 segundos",;
"Processando, aguarde...",;
{ | oDlgSef | UpdCaption( oDlgSef) } )

...

Static function UpdCaption( oDlg )

local nFor, nStart

for nFor := 4 to 0 step -1
nStart = GetTickCount()
while ( GetTickCount() - nStart ) < 1000
end
oDlg:cMsg := " wait for "+;
LTrim( Str( nFor ) ) + " second" + ;
If( nFor > 1, "s", "" )
oDlg:Refresh()
SysRefresh()
next

return nil

Re: Nag Screen

Posted: Fri Sep 20, 2013 9:36 pm
by ADutheil
Silvio,

try this:

Code: Select all


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
 

Re: Nag Screen

Posted: Sat Sep 21, 2013 6:27 am
by Silvio.Falconi
Dear friends,
do You remember the dialog of Copyrights of old Wdbu ?
I mean something of it ...

Re: Nag Screen

Posted: Sat Sep 21, 2013 8:19 am
by Silvio.Falconi
Friends ,
I tried to make a test with numbers and a progress bar but the time progress is not the same of the time for the numbers
where is the error ?

Code: Select all


#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
//-------------------------------------------------------------------------//

 

Re: Nag Screen

Posted: Sat Sep 21, 2013 11:31 am
by ADutheil
Did U try the code I sent? Works OK for me.

Re: Nag Screen

Posted: Sat Sep 21, 2013 11:33 am
by Silvio.Falconi
yes but the meter is not the same of numbers step

Re: Nag Screen

Posted: Sat Sep 21, 2013 2:17 pm
by ADutheil
Check if U have oMeter:Set( nSecs ) before the WHILE of the CountDown function.