r3 - 10 Jun 2009 - 09:30:02 - GunmoRyuYou are here: KoreaCmsWiki >  Sandbox Web > TWikiUsers > GunmoRyu > GunmoRyuSandbox > 2009April > HowToUseTTimer
  • 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 | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
KOREA-CMS
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