Wide Studio Object Reference

Wide Studio Home
Up to


Class Name

WSDtimer

Methods

  • WSDtimer* WSGIappTimer();   :WSDtimer
  • long addTriggerProc(WStimerProc,WSCuchar,void*)   :WSDtimer
  • long addTimerProc(WStimerProc,WSCuchar,void*)   :WSDtimer
  • void delTriggerProc(long);   :WSDtimer
  • void delTimerProc(long);   :WSDtimer


Specification of methods



WSGIappTimer method

Form
WSDtimer* WSGIappTimer()
Function
Returns the global instance of the class: WSDtimer. It is an invarid instance which is created by WSDtimer().
Description
Parameters
Nothing.
Return value
Returns the instance.
Notice
This method is a global function. Do not delete the return value.



addTriggerProc method

Form
long addTriggerProc(WStimerProc proc,WSCuchar rate,void* data)
Function
Executes once the specified procedure after the specified period.
Description
Parameters
(in)WStimerProc proc the addres of the function
(in)WSCuchar rate the period
(in)void* data the value which is passed to the function

There are following value for the period:
WS250MS 250 ms 後
WS500MS 500 ms 後
WS750MS 750 ms 後
WS1000MS 1000 ms 後
WS1250MS 1250 ms 後
WS1500MS 1500 ms 後
WS1750MS 1750 ms 後
WS2000MS 2000 ms 後
WS2250MS 2250 ms 後
WS2500MS 2500 ms 後
WS2750MS 2750 ms 後
中略 中略
WS19750MS 19750 ms 後
WS20000MS 20000 ms 後
Return value
Returns the registration id.
Notice
The type of the function:WStimerProc is defined as follows:
typedef void (*WStimerProc)(WSCuchar,void*);
For example,if the event procedure: sample_event_procedure() is executed by a WSCvbtn instance or something, the trigger procedure: timer_proc() is registered, and it is fired and displays "hello!" after 1 sec.
                  
void timer_proc(WSCuchar clock,void* data){
//This data is the third parameter of addTriggerProc().
  WSCbase* object = (WSCbase*)data;
  object->setProperty(WSNlabelString,"Hello!");
}
void sample_event_procedure(WSCbase* object){
  //Register the trigger proc: 1 sec.
  WSDtimer* timer = WSGIappTimer();
  timer->addTriggerProc(timer_proc,WS1000MS,object);
}



addTimerProc method

Form
long addTimerProc(WStimerProc proc,WSCuchar rate,void* data)
Function
Fires the specified procedure at every the specified cycles.
Description
Parameters
(in)WStimerProc proc The address of the function
(in)WSCuchar rate The cycle
(in)void* data The value which is passed to the function

There are following value for the cycle:
WS250MS 250 ms
WS500MS 500 ms
WS750MS 750 ms
WS1000MS 1000 ms
WS1250MS 1250 ms
WS1500MS 1500 ms
WS1750MS 1750 ms
WS2000MS 2000 ms
WS2250MS 2250 ms
WS2500MS 2500 ms
WS2750MS 2750 ms
中略 中略
WS19750MS 19750 ms
WS20000MS 20000 ms
Return value
登録 ID
Return value
Returns the registration id.
Notice
The type of the function:WStimerProc is defined as follows:
typedef void (*WStimerProc)(WSCuchar,void*);
For example,if the event procedure: sample_event_procedure() is executed by a WSCvbtn instance or something, the timer procedure: timer_proc() is registered, and it is fired and counts up the value at every 1 sec.
                  
void timer_proc(WSCuchar clock,void* data){
//The clock parameter is counted up at every 250MS.
//It is used to see the time.
//This data is the third parameter of addTimerProc().
static int cnt = 0;
  cnt++;
  WSCbase* object = (WSCbase*)data;
  object->setProperty(WSNlabelString,cnt);
}
void sample_event_procedure(WSCbase* object){
  //Register the timer proc: 1 sec cycle.
  WSDtimer* timer = WSGIappTimer();
  timer->addTriggerProc(timer_proc,WS1000MS,object);
}



delTriggerProc method

Form
void delTriggerProc(long id)
Function
Unregisters the procedure by the specified id which is returned by addTriggerProc().
Description
Parameters
(in)long id the registration id

Return value
Nothing.
Notice
If it is after fired,it ignores.



delTimerProc method

Form
void delTimerProc(long id)
Function
Unregisters the procedure by the specified id which is returned by addTimerProc().
Description
Parameters
(in)long id the registration id

Return value
Nothing.
Notice
If it is an invalid id,it ignores.


Document Release 1.0

For Use with Wide Studio Release 1.0, Summer 2000


Wide Stuido Home | Up to

Copyright(C) T. Hirabayashi, 2000 Last modified: July 01, 2000