"David Kendall" <[EMAIL PROTECTED]> wrote:
> My application sets an alarm to schedule an automatic database update
> sometime in the future.
>
> When the alarm is triggered (sysAppLaunchCmdDisplayAlarm), and if my
> application happens to be running, I call FrmCloseAllForms, update
the
> database, then reload the previously active form. This is done
because the
> application may be editing or displaying a record that will be
automatically
> updated.
>
> Now, here's the problem: If the user has the Find dialog up when the
alarm
> is triggered, I can't call FrmCloseAllForms and reload. This zaps
the find
> window. Incredibly, this was discovered by Gremlins!
>
> My solution is to call FrmGetActiveForm and check if the active form
is one
> of mine. If it's not, I simply set a new alarm for 10 minutes from
now, and
> exit.
>
> This works, but I'd like to set the alarm to a much lower value,
maybe 10
> seconds.
>
> Here's my question: does sysAppLaunchCmdDisplayAlarm wake up the
device if
> it's in sleep mode? If so, I can't use a short retry because it
would keep
> the device awake. How about if I use sysAppLaunchCmdAlarmTriggered
and nix
> further processing?
>
> What are the battery-life implications of waking up the device every
10
> minutes all night long?
>
> Any comments on this whole approach?
If I understand correctly, your goal in closing the form and then re-
opening it is to:
1. refresh the display if the record gets updated
2. undo any (as yet unsaved) change that the user may have made to a
record that you may update
Assuming this is true, here's another approach you may try: instead of
closing the form, send an event to the form that your form handler
processes by reloading the record and redrawing the form. If you need
to make the form handler release the record (assuming the form handler
has done a get on the record), use two events: one to get the form to
release the record before you do the database update, and another to
get the form to reload and redraw after you have done the update.
I use this technique in my Silence app, although for a slightly
different purpose.
--
Roger Chaplin
<[EMAIL PROTECTED]>