I think I want a "dumb" form because I might have several different
processes in different parts of my program that are long running and I want
to the progress form to be able to be used by any of them without changing
it's underlying code. That's why I was shifting most of the processing out
of the event handler for the popup form. My goal was to make it generic in
the sense that any long running function block could pop it up and pass
progress messages to it.
> 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);