Timer and Dialog

Timer and Dialog

Postby anserkk » Thu Apr 16, 2009 9:44 am

Hi friends,

The Timer is not functioning when I modified the TestTim3.Prg In FWH\Samples. The only change which I have made is that I used Dialog instead of Wndow.

If I change the DIALOG back to WINDOW, then The Timer is working fine. I am confused with this.


Code: Select all  Expand view
#include "FiveWin.ch"

static oWnd
static lActive := .f.

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

function Main()

   local oTmr

   DEFINE DIALOG oWnd TITLE "FileControl"

   DEFINE TIMER oTmr INTERVAL 10000 ACTION CheckFile() OF oWnd

   ACTIVATE TIMER oTmr

   ACTIVATE DIALOG oWnd

return nil

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

function CheckFile()

   if ! lActive
      lActive = .t.
      MsgInfo( "I check anything from here" )
      lActive = .f.
   endif

return nil

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


Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Timer and Dialog

Postby Antonio Linares » Thu Apr 16, 2009 10:46 am

Anser,

You have to create the TIMER from the ON INIT clause of the DIALOG, as the TIMER needs an existing windows or dialog handle:

ACTIVATE DIALOG oDlg ON INIT BuildTimer( oDlg )

The windows handle of a DIALOG is not created until the DIALOG is ACTIVATEd
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Timer and Dialog

Postby anserkk » Thu Apr 16, 2009 11:44 am

Thankyou Mr.Antonio,

It is working fine when I tried as per your suggestion. I wonder why this difference in Window and Dialog.

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Timer and Dialog

Postby Antonio Linares » Thu Apr 16, 2009 1:22 pm

Anser,

> I wonder why this difference in Window and Dialog

It is a Windows API design difference:

* A window is created and it can be activated (shown, managed) later on.

* A dialog is created and activated at the same time, so (FWH) DEFINE DIALOG does not really create it, instead it prepares everything that is needed for the moment when it is really created from the ACTIVATE DIALOG command.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Timer and Dialog

Postby anserkk » Thu Apr 16, 2009 2:59 pm

Dear Mr.Antonio,

That's a very useful information. Thankyou very much

Regards
Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India


Return to FiveWin for Harbour/xHarbour

Who is online

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