Hi Folks,
I have a long-running task that manages a data-transfer between a PC and an
external device attached to the serial port. I have implemented it as a
Services.Action, so that it can execute without blocking the framework.
The problem is this: if the user closes the application becore the task has
finished, data may be lost and the external device may be left in an
undefined state. If the user tries to close the application, I would like
some way of prompting the user, and cleaning up afterwards if they confirm
that the task is to be cancelled.
I can't see a mechanism in the framework for doing this. If I were
programming directly to Win32, I could process the WM_CLOSE message and
handle any prompts and finalisation of background tasks. Does anything
similar exist within BCF? The framework must process this message itself,
since it prompts the user to save modified documents before it exits. The
user can cancel the close request by replying to one of these dialogs.
It would be nice to have something similar for Actions. For example, there
could be a special type of Action that the framework would always query
before closing. If such an Action declined a cancel request, a request to
close the application would be declined. For example:
PROCEDURE (a : MyAction) MayCancel () : BOOLEAN;
VAR res : INTEGER;
BEGIN
Dialog.GetOK("A data transfer is still in process.
Do you want to abort the task ?", "", "", "",
{Dialog.yes, Dialog.no}, res);
IF res = Dialog.yes THEN
... clean-up background process ...
RETURN TRUE;
ELSE
RETURN FALSE;
END;
END MayCancel;
Would this sort of scheme be workable?
Cheers,
- Stewart
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Received on Mon Aug 23 1999 - 04:21:31 UTC