Using CTimer????
| Tue, 2003-10-21 07:56 | |
|
Hi,
I'm deriving from CTimer class, to create a timer to display a splash screen. My timer is instantiated in ConstructL of the AppUi class, I pass it a pointer to my Container class (which does the drawing). The idea behind this is that when the timer expires it will call the RunL method which in my case is used to set a flag in the container class to stop it from drawing the splash screen code, & to set the controls for the main view visible. However, when I try & call the SetActive() method on the timer (before I call After()) SetActive crashes. If I call After() before I call SetActive, After() crashes. Have I forgotten something? Am I doing something wrong? Any help would be muchly appreciated as I have been stuck on this for a long time. Thanks. |
|






void MyClass::start() {
if(timer==0) {
timer=CPeriodic::New(CActive::EPriorityStandard);
timer->Start(TTimeIntervalMicroSeconds32(100000),TTimeIntervalMicroSeconds32(100000),TCallBack(TimeTick,this));
}
}
// Method in MyClass which will get called by the TimeTick function when the timer goes off
void MyClass::tick() {
// Do whatever
}
// Global function which simply passes the timer tick back to MyClass
TInt TimeTick(TAny *obj) {
((MyClass *)obj)->tick();
return 0;
}
Forum posts: 29
Forum posts: 2009
I used to have the problem some weeks ago but I cannot reproduce it.
And I have not found any solution in phpbb to solve this.
Sorry for the inconvenience.
Eric
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 4
-Call StartTimer()
// After Splash bilden
void CAAppUi::StartTimer()
{
if(iPeriodic) StopTimer();
// How long the splash will be viewd
const TInt tickInterval=3000000;
iPeriodic=CPeriodic::NewL(0);
iPeriodic->Start(tickInterval,tickInterval,TCallBack(Tick, this));
}
void CAAppUi::StopTimer()
{
if(iPeriodic)
{
iPeriodic->Cancel();
delete iPeriodic;
iPeriodic = NULL;
}
}
// This method must be protected in your header file
TInt CAAppUi::Tick(TAny* aObject)
{
return ((CAAppUi*)aObject)->DoTick();
}
TInt CAAppUi::DoTick()
{
// Go on and start the rest of your program
return 0;
}
/Fadi