vziskin@mitlns.mit.edu wrote: > > > Is there a way to run more thatn one timer at the same time in the same > function. I seem to have difficultiy doing that. Would anyone have a > comprehensive example in which they utilize more than one ttimer. > > Thanks, Vitaliy > Hi Vitaliy, please, read how to work with timers at http://root.cern.ch/root/htmldoc/TTimer.html The comprehensive example of using several timers is the tetris game at $ROOTSYS/test/Tetris.* Check the following examples of using signal-slots with timers ////////////////// timer.C ///////////////////////////////////////////// TTimer* timer1; TTimer* timer; void timer() { timer1 = new TTimer(500,kFALSE); timer1->Connect("Timeout()",0,0,"print1()"); timer1->TurnOn(); //-----------------------> works if this is commented timer = new TTimer(2000,kFALSE); timer->TurnOn(); timer->Connect("Timeout()",0,0,"print2()"); // delete timer; // delete timer1; } void print1() { printf("timer1 has run out @ %s\n",timer1->GetTime()->AsString()); } void print2() { printf("timer2 has run out @ %s\n",timer->GetTime()->AsString()); } HTH. Regards. Valeriy
This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:23 MEST