Timer on a Dialog

Timer on a Dialog

Postby vilian » Thu Nov 21, 2024 8:44 pm

Hi Guys,
I'm trying create a Timer on a dialog by this way:

Code: Select all  Expand view  RUN

DEFINE DIALOG oDlg RESOURCE "TESTE01" OF oWnd

       REDEFINE BITMAP oBmp ID 101 OF oDlg FILE (cQrc) ADJUST UPDATE
       REDEFINE METER oMtr VAR nPerc TOTAL 100 ID 102 OF oDlg UPDATE
               
       REDEFINE BUTTONBMP ID 105 OF oDlg ACTION ( oDlg:End() ) CANCEL UPDATE

       DEFINE TIMER oTmr OF oDlg INTERVAL 5000 ACTION Consultar(oDlg,oTmr,oMtr,@nPerc,cIDPix)

 ACTIVATE DIALOG oDlg CENTERED ;
               ON INIT oTmr:Activate()

However, the function Consultar() is never being executed. Do you know Why ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Timer on a Dialog

Postby paquitohm » Thu Nov 21, 2024 9:37 pm

So perhaps,

DEFINE TIMER oTmr OF WndMain() INTERVAL 5000 ACTION Consultar(oDlg,oTmr,oMtr,@nPerc,cIDPix)
paquitohm
 
Posts: 266
Joined: Fri Jan 14, 2022 8:37 am

Re: Timer on a Dialog

Postby Enrico Maria Giordano » Thu Nov 21, 2024 10:13 pm

Or:

Code: Select all  Expand view  RUN
ON INIT ( oTmr:hWndOwner := oDlg:hWnd, oTmr:Activate() )
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Timer on a Dialog

Postby Marc Venken » Fri Nov 22, 2024 8:22 am

I have this in my code... (grabed it somewhere here)

Code: Select all  Expand view  RUN


     oDlg:bInit := <||
      DEFINE TIMER oTimer OF oDlg INTERVAL 100 ;
         ACTION If( nStartSec == nil,,( nSecsLapsed := SecsLapsed( nStartSec ),oSay:Refresh() ) )
      ACTIVATE TIMER oTimer
      return nil
      >

     ACTIVATE DIALOG oDlg CENTERED;
     VALID ( oTimer:End(), .t. )

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1436
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Timer on a Dialog

Postby vilian » Fri Nov 22, 2024 10:58 am

Thank you Enrico,
It worked perfectly ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 64 guests