"Fawcett, Mitch" wrote:
>
> I'm not making myself clear. I am writing a generic progress meter that
> allows me to interrupt a long running process. I need a form to pop up at
> the beginning of a long running process that displays a progress status
> message and a cancel button. All the form does is display a string that is
> sent to it and be able to detect if the cancel button is tapped. If cancel
> is tapped, set a global variable and close the form.
Well, AFAIK there are usually two approaches to this:
a. a "smart" form that handles most the progress stuff
b. a "dumb" form that just updates a meter when told
One easy way is to open the form and roll your own event
loop from there.
This assumes that the progress form is smart and allocates
time handling to the function that needs a progress meter. The
other approach would be to allocate time to detect events in
the progress form.
Hope this helps,
Daniel.
For example... (smart progress form)
curForm = FrmGetActiveForm();
frm = FrmInitForm(MyProgressFormID);
FrmSetActiveForm(frm);
FrmDrawForm(frm);
while (!done) {
EvtGetEvent(&event, evtWaitForever);
handled = FrmHandleEvent(frm, &event);
if (SysHandleEvent(&event))
continue;
if (event.eType == ctlSelectEvent) {
switch (event.data.ctlSelect.controlID) {
case MyCancelButtonID:
done = true;
break;
}
else if (event.eType == appStopEvent) {
EvtAddEventToQueue(&event);
break;
}
}
FrmEraseForm(frm);
FrmDeleteForm(frm);
if (curForm)
FrmSetActiveForm(curForm);