Hi there,
When running my app that I have developed, I shut the Palm off with the app
still running.
This seems to decrease the battery life noticeably.
What am I doing wrong?
I have attached my EventLoop code in the case someone can spot my error
Thank you for your help,
================================
static void EventLoop(void)
{
short err;
EventType event;
long appStarted = TimGetSeconds();
g.running = true;
do
{
if (TimGetSeconds() >= appStarted + FIVE_MINUTES) {
if (invalidUserName()) {
FrmAlert(1001);
break;
}
}
EvtGetEvent(&event, 1);//For now
doLetterTimer(&g.teacherWords);//Letter finished yet?
doLetterTimer(&g.studentWords);
doAnimation(&g.teacherWords); //Do next animations if time
doAnimation(&g.studentWords);
//Stop animation and repair damage BEFORE menu drops
if ((event.eType == keyDownEvent) &&
(event.data.keyDown.chr == menuChr) &&
(FrmGetFormId(FrmGetActiveForm()) == MAIN_FORM_ID)) {
int redrawStudentLetter = studentAnimating() ?
g.studentWords.animateLetter : -1;
int redrawTeacherLetter = teacherAnimating() ?
g.teacherWords.animateLetter : -1;
stopAndResetAnimations();
//(drawLetter won't draw if letterIndex < 0
if (redrawStudentLetter >= 0) {
repairStudentArea();
}
drawLetter(&g.teacherWords, redrawTeacherLetter);
}
if ((event.eType == keyDownEvent) &&
g.disableButtons) {
switch (event.data.keyDown.chr) {
case launchChr: //Application silk-screen
case menuChr: //Menu silk-screen
case calcChr: //Calculator silk-screen
case findChr: //Find silk-screen
case hard1Chr: //ToDo button
case hard2Chr: //PhoneList button
case hard3Chr: // button
case hard4Chr: //Memo button
case hardPowerChr://Power button
case pageUpChr: //ScrollUp button
case pageDownChr://ScrollDown button
SndPlaySystemSound(sndConfirmation);
continue;
break;
}
}
if (!SysHandleEvent(&event)) {
if (!MenuHandleEvent((void *)0, &event, &err)) {
if (event.eType == appStopEvent) {//Query if screen not clear
if (teacherAreaClear() && studentAreaClear()) {
g.running = false; //Just quit
}
else {
if (!FrmAlert(1008)) {
g.running = false;
}
}
}
if (!ApplicationHandleEvent(&event)) {
FrmDispatchEvent(&event);
}
}
}
/* if (event.eType != nilEvent) {
Err err = MemHeapCheck(MemPtrHeapID(StudentNames[0]));
if (err) {
StrPrintF(g.tempStr, "Heap check failed %d", err);
ErrFatalDisplayIf(true, g.tempStr);
}
}
*/
} while (g.running);
}
Robert Crago
Revelation Computing Pty Limited
PO Box 459, ASPLEY
Brisbane, Australia 4034
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html