Dr. Vesselin Bontchev wrote:
Sigh... A search through the archives for "sysAppLaunchCmdDisplayAlarm" yielded in only 70 messages. I read them all. Only one of them is really relevant to my problem - this one:
http://news.palmos.com/read/messages?id=31795
It's from somebody who is experiencing exactly the same problem. And - surprise, surprise - nobody answered his plea for help, either. :-( I seem to have a knack for enountering problems for which people don't know the solution... :-((
Seems you have a lot of hazzle with this...
What I do in 2PlayMe, when the alarm arrives and I want to do the safe alarm with snooze option:
in PilotMain
else if (cmd == sysAppLaunchCmdAlarmTriggered)
{
((SysAlarmTriggeredParamType *) cmdPBP)->purgeAlarm = HandleAlarm(cmdPBP, launchFlags);
}
in HandleAlarm
if (error == errNone)
{
UInt16 nBtnID = buttonID_close;
FormPtr oldForm = FrmGetActiveForm();
FormPtr form = FrmInitForm(formID_alarm1);
if (form)
{
if (loc_prefs->bSafeAlarm)
{
UInt16 cardNo = 0;
LocalID dbID = NULL;
DmSearchStateType searchInfo;
UInt32 seconds = TimGetSeconds() + 600;error = DmGetNextDatabaseByTypeCreator (true, &searchInfo, sysFileTApplication, MainAppID, true, &cardNo, &dbID);
if (error == errNone)
error = AlmSetAlarm (cardNo, dbID, 2, seconds, false); // ref = 2, to indicate safe alarm
}
nBtnID = FrmDoDialog(form);
FrmDeleteForm(form);
}
FrmSetActiveForm(oldForm);
then I purge the display alarm. My HandleAlarm may not help you, because, you need things to be done during the form display, so try this version, which I had before I switched to FrmDoDialog:
if (error == errNone)
{
UInt16 nBtnID = buttonID_close;
FormPtr oldForm = FrmGetActiveForm();
FormPtr form = FrmInitForm(formID_alarm1);
if (form)
{
EventType event;
UInt32 startTime;FrmDrawForm(form);
FrmSetActiveForm(form);
FrmSetEventHandler(form, alarm);
startTime = TimGetSeconds();
while (true)
{
EvtGetEvent(&event, 10 * SysTicksPerSecond()); if (SysHandleEvent(&event))
continue;
if (MenuHandleEvent((void *)0, &event, &error))
continue; FrmDispatchEvent(&event);
if (event.eType == appStopEvent)
break;
if (loc_prefs->bSafeAlarm)
{
// after 10 minutes without user interaction, we call the
system alarm
if ((TimGetSeconds() - startTime) > 600)
{
SndPlaySystemSound(sndAlarm);
SysTaskDelay(SysTicksPerSecond());
SndPlaySystemSound(sndAlarm);
SysTaskDelay(SysTicksPerSecond());
SndPlaySystemSound(sndAlarm);
break;
}
}
if (event.eType == ctlSelectEvent)
{
nBtnID = event.data.ctlSelect.controlID;
break;
}
};
FrmEraseForm(form);
}
FrmSetActiveForm(oldForm);
Regards Henk -- ------------------------------------------------------------------------- Henk Jonas [EMAIL PROTECTED] Palm OS Â certified developer
Please contact me, if you need an off-side contract worker. -------------------------------------------------------------------------
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
