• TTimer is used for repeating the jobs each a little seconds.
  • TTimer needs the class for use.
  • See the below.

class Test_timer{
RQ_OBJECT("Test_timer")         // RQ_OBJECT is macro on ROOT. It allows "Connect" method to available.

public :
    Test_timer(){}
    ~Test_timer(){}
    void TimeDone()                  // Here. TimeDone methods plays a roll as SLOT.
    {
        printf("hello\n");
    }
};


exam_timer()
{

    TTimer* timer = new TTimer();     // TTimer is created.
    Test_timer* tt;                           // Class is created for use TTimer. You must set the instance to pointer.
    timer->Connect("Timeout()","Test_timer",tt,"TimeDone()");  // Now, Connect between timer and class method.
    timer->Start(2000,kFALSE);        // First argument is time(ms), eg. 2000 means 2 seconds. 
                                                    // kFALSE means that it is to repeat. However, kTRUE means that it is only used at first time. 
}

-- GunmoRyu - 30 Apr 2009

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2009-06-10 - GunmoRyu
 
KOREA-CMS
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding KoreaCmsWiki? Send feedback