FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Timer and Dialog
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Timer and Dialog
Posted: Thu Apr 16, 2009 09: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 (fw): Select all Collapse
#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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Timer and Dialog
Posted: 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
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Timer and Dialog
Posted: 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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Timer and Dialog
Posted: Thu Apr 16, 2009 01: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
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Timer and Dialog
Posted: Thu Apr 16, 2009 02:59 PM

Dear Mr.Antonio,

That's a very useful information. Thankyou very much

Regards
Anser

Continue the discussion