Re: [ROOT] using TTimer

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon May 07 2001 - 18:05:14 MEST


Hi Ivan,

  synchronous timers are only processed when the program processes
events via gSystem->ProcessEvents(). So in your case there is a 
chicken and the egg problem. Best is just to regularly in your
canvas update loop to call gSystem->ProcessEvents() or if you
want it to be timer driven use an a-synch timer TProcessEventTimer
(via TSystem.h) and for its use check TTreePlayer.cxx (see:
http://root.cern.ch/lxr/source/treeplayer/src/TTreePlayer.cxx#1095)


Cheers, Fons.

  
Ivan Storgaard Vogelius wrote:
> 
> Hi!
>         I want to create a TTimer to update interactions with canvas
> regularly. I tried to do the following:
>   TTimer *timer= new TTimer(500, kTRUE);
>   timer->SetCommand("gSystem->ProcessEvents()");
>   timer->TurnOn();
> 
> But It causes the programme to crash(in CINT or compiled). How should it
> be done?
> 
>         Thanks
>         Ivan

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:24 MEST