MsgInfo() with Timer

MsgInfo() with Timer

Postby Anderson.OL » Tue Feb 01, 2011 12:57 pm

Good morning everyone ..

Has anyone modified the function MsgInfo () so that if the user is not near the pc, after 5 seconds it closes and the system continues its processing?
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil

Re: MsgInfo() with Timer

Postby ukoenig » Tue Feb 01, 2011 3:24 pm

Hello,
I think instead of using Msginfo :

MsgWait( "Please, just wait a little!", "This is a test", 15 ) // 15 Seconds

MsgInfo() is used, to force a user, to take notice of something happend.

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: MsgInfo() with Timer

Postby Anderson.OL » Tue Feb 01, 2011 4:51 pm

I created the following functions

Code: Select all  Expand view
****************************************************************************
static procedure MsgTimer(cMessageCaption, nSeconds)
****************************************************************************
*
* Fechar um MsgDialog automaticamente
* Parametros: cMessageCaption, nSegundos
* Retorno: Nenhum
*
* Autor: Anderson
* 1/2/2011 - 12:03:46
*
****************************************************************************

public oTmr := NIL

   Define Timer    oTmr             ;
          Interval 1000             ;
          ;//Action   (if (nHandle > 0 , nTempo++  , /* nada faz */ ),;
          ;//          DoIncTimer() )  ;
          Action   DoIncTimer(cMessageCaption, nSeconds);
          of       oWnd
         
   oTmr:Activate()

Return Nil

/*------------------------------------------------------------------------*/

****************************************************************************
static procedure DoIncTimer(cMessageCaption, nSeconds)
****************************************************************************
*
* Tarefa a ser executada antes de estourar o timer
* Parametros: cMessageCaption, nSeconds
* Retorno: Nenhum
*
* Autor: Anderson
* 1/2/2011 - 12:17:07
*
****************************************************************************

static nHandle := -1
static nTempo  := 0

   if nHandle <= 0
      nHandle := FindWindow(nil, cMessageCaption)
      SetWindowText(nHandle,cMessageCaption + ' (' + StrTrim(nSeconds - nTempo) + ')')
   end

   if nHandle > 0
   
      //-- Começa a contar a partir do momento que acha a janela ---------//
     
      nTempo++
     
      if nTempo == nSeconds
     
         //-- Se estorou o tempo fecha a janela e destroi o timer --------//
         SendMessage(nHandle, WM_CLOSE)
         oTmr:Deactivate()
         oTmr:End()
         Release oTmr
         
      else
     
         //-- Exibe a contagem do tempo ----------------------------------//
         
         SetWindowText(nHandle,cMessageCaption + ' (' + StrTrim(nSeconds - nTempo) + ')')
         
      end
     
   end

Return Nil

/*------------------------------------------------------------------------*/

And I use this way.

Code: Select all  Expand view
MsgTimer('Informação',10)
MsgInfo('Mensagem','Informação')
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 108 guests