timer with a button

timer with a button

Postby artu01 » Tue Sep 11, 2018 1:12 am

Hi guys,
I want to do a timer that shows a message after 10 seconds de pressing the button
please help me

Gente:
Necesito programar un timer dentro de un botón que despues de 10 segundos de presionado muestre un msje
ayuda por favor
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: timer with a button

Postby karinha » Tue Sep 11, 2018 2:56 pm

Image
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7846
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: timer with a button

Postby karinha » Tue Sep 11, 2018 2:59 pm

Code: Select all  Expand view  RUN

//-> By Joao Santos - Sao Paulo - Brazil - kapiabafwh@gmail.com
//-> Participacao Especial, Vailton Renato - renato@kssoftware.com.br

#Include "FiveWin.Ch"

STATIC oDlgRelog, oTimerRelog, lDesliga := .F., oWnd, oTimerPorta
STATIC oFnt, oSaida

//---------------------------------------------------------------------------//

FUNCTION RELOG()

   LOCAL oSayMens, oFnt2, aGrad

   oSayMens := "This a Test message"

   aGrad := { { 0.30, CLR_BLACK, CLR_YELLOW},{ 0.70, CLR_YELLOW, CLR_BLACK } }

   DEFINE FONT oFnt  NAME "Arial"         SIZE 08,  20 BOLD
   DEFINE FONT oFnt2 NAME "Arial"         SIZE 00, -12 BOLD

   DEFINE DIALOG oDlgRelog FROM 3, 3 TO 20, 50                              ;
          TITLE "Test of Message with Timer"                                ;
          GRADIENT aGrad TRANSPARENT                                        ;
          STYLE nOR( DS_MODALFRAME )

   oDlgRelog:lHelpIcon := .F.

   @ .5,10 SAY oSayMens OF oDlgRelog SIZE 100, 12                           ;
           COLOR CLR_BLACK, CLR_WHITE TRANSPARENT ADJUST

   @ 5, 11 BUTTON oSaida PROMPT "&Timer" OF oDlgRelog                       ;
           SIZE 50, 14                                                      ;
           ACTION( ACIONA_TIMER( oWnd ) )

   oSaida:cToolTip := "Timer"

   SET FONT OF oSaida    TO oFnt
   SET FONT OF oDlgRelog TO oFnt2

   ACTIVATE DIALOG oDlgRelog CENTERED

   IF lDesliga
      oTimerRelog:DeActivate()
      oTimerPorta:DeActivate()
   ENDIF

   oFnt:End()
   oFnt2:End()

RETURN NIL

FUNCTION ACIONA_TIMER( oWnd )

   DEFINE TIMER oTimerPorta INTERVAL 50  OF oDlgRelog                        ;
          ACTION ACIONA_RELOGIO( oWnd )

   ACTIVATE TIMER oTimerPorta

RETURN NIL

FUNCTION ACIONA_RELOGIO( oWnd )

   LOCAL oFont

   DEFINE FONT oFont NAME "Arial" SIZE  0, -70 BOLD
   DEFINE FONT oFnt  NAME "Arial" SIZE 08,  20 BOLD

   DEFINE TIMER oTimerRelog INTERVAL 50                                      ;
          ACTION ExibeRelogio()

   ACTIVATE TIMER oTimerRelog

   SET FONT OF oDlgRelog TO oFont
   SET FONT OF oSaida    TO oFnt

   oFont:End()

   lDesliga := .T.  //-> Para Desligar o Timer

   oTimerPorta:DeActivate()

RETURN NIL

FUNCTION ExibeRelogio()

   LOCAL NewMensa := "Mensagem"

   // Mensageria
   IF ISWINDOWVISIBLE( oDlgRelog:hWnd )

       oDlgRelog:Say( 3, 01, NewMensa,                                      ;
                 CLR_YELLOW, CLR_BLACK,, .F. )
       // .T. Esquerda - .F. Direita da Dialog.

   ENDIF

RETURN NIL

//-> FIM / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7846
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests