Nag Screen

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Nag Screen

Post by Silvio.Falconi »

Someone have a mall sample of Nag-screen for a wait time of 20 seconds ? thanks
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Nag Screen

Post by Antonio Linares »

Silvio,

function MsgWait( cMsg, cTitle, 20 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Nag Screen

Post by Silvio.Falconi »

opps sorry
but I wish show the seconds
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Wanderson
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Nag Screen

Post 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
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Nag Screen

Post 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
 
Last edited by ADutheil on Sat Sep 21, 2013 11:30 am, edited 1 time in total.
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Nag Screen

Post by Silvio.Falconi »

Dear friends,
do You remember the dialog of Copyrights of old Wdbu ?
I mean something of it ...
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Nag Screen

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

 
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Nag Screen

Post by ADutheil »

Did U try the code I sent? Works OK for me.
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Nag Screen

Post by Silvio.Falconi »

yes but the meter is not the same of numbers step
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Nag Screen

Post by ADutheil »

Check if U have oMeter:Set( nSecs ) before the WHILE of the CountDown function.
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
Post Reply