Recent

Author Topic: Error encountered with fptimer  (Read 14532 times)

jl

  • Full Member
  • ***
  • Posts: 178
Error encountered with fptimer
« on: February 12, 2010, 06:24:43 pm »
Hi, sometime back, I had a problem with getting TTimer to work with a Daemon, and was advised to use fptimer instead as TTimer only works with GUI app - http://mantis.freepascal.org/view.php?id=14118&nbn=5

I've encountered some issues with fptimer, search google for all articles on fptimer, but no clues. :(

Code: [Select]
uses
fpTimer;
...
public
    procedure FTimerTimer( Sender : TObject );  
.....

procedure TDaemon1.FTimerTimer( Sender : TObject );
var
...
 BEGIN
....
END;                

procedure TDaemon1.DataModuleStart(Sender: TCustomDaemon; var OK: boolean);
var
...
begin    
 FTimer := TFPTimer.Create(nil);
 FTimer.OnTimer := @FTimerTimer;
 FTimer.Interval := 1000; // in milliseconds
 FTimer.Enabled := True;        
 FTimer.on;    --> this line throws the error: identifier idents no member "on"

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1935
Re: Error encountered with fptimer
« Reply #1 on: February 12, 2010, 06:54:58 pm »
What is your question?

jl

  • Full Member
  • ***
  • Posts: 178
Re: Error encountered with fptimer
« Reply #2 on: February 12, 2010, 08:56:57 pm »
 FTimer.on;    --> this line throws a complilation error: identifier idents no member "on"

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1935
Re: Error encountered with fptimer
« Reply #3 on: February 12, 2010, 09:19:55 pm »
FTimer.on;    --> this line throws a complilation error: identifier idents no member "on"

It says there is no member "on".  But what is the question?

jl

  • Full Member
  • ***
  • Posts: 178
Re: Error encountered with fptimer
« Reply #4 on: February 13, 2010, 08:57:27 pm »
Thanks, I can't seem to get fptimer to work.  in the above example, compiling with the line  "FTimer.on;"   shows a compilation error: identifier idents no member "on"

I used the example shown on this thread - http://readlist.com/lists/lists.freepascal.org/fpc-pascal/0/3900.html

Now I opened the file fptimer.pp in fcl-base, saw that there's a StartTimer, so I replaced  FTimer.on;  with FTimer.StartTimer;

Still not working.   :-\

by the way, the code is placed on  TDaemon1 = class(TDaemon)
« Last Edit: February 13, 2010, 09:02:28 pm by touchring »

jl

  • Full Member
  • ***
  • Posts: 178
Re: Error encountered with fptimer
« Reply #5 on: February 18, 2010, 02:59:28 pm »
Any thoughts?   %)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2674
Re: Error encountered with fptimer
« Reply #6 on: February 18, 2010, 11:52:22 pm »
FTimer.On is based on the example implementation of fptimer in the attached file threadtimer.pas in the same thread.
If you continue reading that thread you see that the sample implementation is split up. I don't tknow if there is a default TTimerDriver installed.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

jl

  • Full Member
  • ***
  • Posts: 178
Re: Error encountered with fptimer
« Reply #7 on: February 19, 2010, 05:08:35 am »
FTimer.On is based on the example implementation of fptimer in the attached file threadtimer.pas in the same thread.
If you continue reading that thread you see that the sample implementation is split up. I don't tknow if there is a default TTimerDriver installed.

Yes, this procedure is absent from \packages\fcl-base\src\fptimer.pp

procedure TFPTimer.On;
begin
StartTimer;
end;

So, I've changed the code to calling StartTimer directly.

By the way, I got a reply from Michael, somehow I did not get that reply in my email.

http://lists.lazarus.freepascal.org/pipermail/lazarus/2010-February/049480.html

Would there be a work around solution?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2674
Re: Error encountered with fptimer
« Reply #8 on: February 19, 2010, 10:41:45 am »
Ask the mailing list for a solution. Michael knows the timer better than me
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018