Re: [fpc-pascal] Cannot get TFPTimer to work

2010-12-02 Thread Burkhard Carstens
Am Donnerstag, 2. Dezember 2010 19:39 schrieb Darius Blaszyk:
 Whatever I tried, I cannot get TFPTimer to work. Can someone help?
 For some reason the OnTimer even is never fired. Tried on Windows and
 Linux. Here's a snippet I used as test.

 Regards, Darius


[..]

 begin
   test := TBaseObj.Create;
   for i := 1 to 1000 do

begin

 sleep(10);

checkSynchronize;
end;


   writeln('done');
   readln;
 end.

Isn't OnTimerExec called using Synchronize?



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cannot get TFPTimer to work

2010-12-02 Thread Michael Van Canneyt



On Thu, 2 Dec 2010, Burkhard Carstens wrote:


Am Donnerstag, 2. Dezember 2010 19:39 schrieb Darius Blaszyk:

Whatever I tried, I cannot get TFPTimer to work. Can someone help?
For some reason the OnTimer even is never fired. Tried on Windows and
Linux. Here's a snippet I used as test.

Regards, Darius



[..]


begin
  test := TBaseObj.Create;
  for i := 1 to 1000 do


begin


sleep(10);


checkSynchronize;
end;



  writeln('done');
  readln;
end.


Isn't OnTimerExec called using Synchronize?


Yes.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cannot get TFPTimer to work

2010-12-02 Thread Darius Blaszyk
 checkSynchronize;

Thanks Burkhard. It works now.

Regards, Darius

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cannot get TFPTimer to work

2010-12-02 Thread Brian Winfrey
See .../fpcsrc/packages/fcl-base/examples/testtimer.pp for example usage.


On Thu, Dec 2, 2010 at 10:39 AM, Darius Blaszyk
dhkblas...@zeelandnet.nl wrote:
 Whatever I tried, I cannot get TFPTimer to work. Can someone help? For
 some reason the OnTimer even is never fired. Tried on Windows and Linux.
 Here's a snippet I used as test.

 Regards, Darius



 program fptimertest;

 {$mode objfpc}{$H+}

 uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  SysUtils, fpTimer;

 type

  { TBaseObj }

  TBaseObj = class(TObject)
     tmr: TFPTimer;
  public
     constructor Create;
     constructor Destroy;
     procedure OnTimerExec(Sender: TObject);
  end;

 { TBaseObj }

 constructor TBaseObj.Create;
 begin
  tmr := TFPTimer.Create(nil);
  tmr.Interval := 1;
  tmr.OnTimer:=...@ontimerexec;
  tmr.StartTimer;
 end;

 constructor TBaseObj.Destroy;
 begin
  tmr.StopTimer;
  tmr.Free;
 end;

 procedure TBaseObj.OnTimerExec(Sender: TObject);
 begin
  writeln('Timer executed');
 end;

 var
  test: TBaseObj;
  i: integer;

 begin
  test := TBaseObj.Create;
  for i := 1 to 1000 do
    sleep(10);

  writeln('done');
  readln;
 end.

 ___
 fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal