Re: fl_show_alert (changed from: XForms: V0.87 is available for testing)

Tristan Savatier (tristan@mpegtv.com)
Sun, 20 Jul 1997 14:52:12 -0700

To subscribers of the xforms list from Tristan Savatier <tristan@mpegtv.com> :

Steve Lamont wrote:
>
> To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
>
> > Currently, when an alert goody is opened with fl_show_alert(),
> > any previously opened alert goody is closed
> > by Xforms.
> >
> > Alert goodies should (IMHO) stay opened until
> > closed by the user.
> > ^^^^^^^^^^^
>
> I don't understand this complaint. Alert goodies block interaction
> until the button is pressed. They exhibit the described behavior, as
> far as I can tell. I can't see how you could have two alerts on the
> screen at once from a single application.

In my case, here is how it happens:

The Xforms application "listen" to a pipe with a callback
installed with fl_add_io_callback().

Commands arrive on this pipe (totally asynchronously), and
some commands can cause alerts to be displayed.

If I use fl_show_alert(), I have the following problem:
If one alert message is diplayed, and then a second command arrives
shortly after the first one and causes another alert message,
then the first alert goody gets closed by Xforms. There is no
way to know that the user actually read the first alert
message since he did not click OK to close it.

> I suppose you could generate a second alert from some sort of
> background task but in my test code, at least, they are displayed
> sequentially and not simultaneously.

Yes, but sequentially is not good enough. When the two
messages arrive withing 1/10th of a second, it is virtually
impossible for the user to read the first one, and IMHO
alerts should be imperatively acknowleged by the user
(by clicking OK).

I think stacking alerts would solve this problem without
creating any new one. (i.e. creating a new alert goody form when
fl_show_alert() is called, and freeing it when the user closes it).

This is exactly what I do in my fl_show_alert() replacement:

void
show_alert(s1, s2, s3, n)
const char *s1;
const char *s2;
const char *s3;
int n; /* not used in this replacement routine... */
{
FD_alert *alert;

if ((alert = create_form_alert()) == NULL) {
FATAL_ERROR(("cannot create Alert form"));
}
fl_set_object_label(alert->s1, s1);
fl_set_object_label(alert->s2, s2);
fl_set_object_label(alert->s3, s3);

fl_set_form_atclose(alert->alert, at_close_free, NULL);
fl_set_form_icon(alert->alert, Icon_pixmap, 0);

show_and_raise_form(alert->alert, FL_PLACE_CENTER, FL_FULLBORDER,
"MpegTV Alert");
}

static int
at_close_free(fl_form, data)
FL_FORM *fl_form;
void *data;
{
fl_hide_form(fl_form);
fl_free_form(fl_form);
return FL_IGNORE;
}

static void
show_and_raise_form(form, place, border, title)
FL_FORM *form;
int place;
int border;
const char *title;
{
fl_show_form(form, place, border, title);
fl_raise_form(form);
}

Tell me if you need the create_form_alert() and the FD_alert
definition. I created my FD_alert form to look alike the
alert goody (using fdesign).

Regards, -- Tristan Savatier (President, MpegTV LLC)

MpegTV: /cgi-bin/exit-to?http://www.mpegtv.com
MPEG.ORG: http://www.mpeg.org - Foot: http://www.bok.net/~tristan
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/