tomt@maui.coral.COM (Tom Tulinsky) (06/19/91)
In the X Frequently Asked Questions list, no. 106, some code is given that allows you to query the user at a given point in a program and not proceed past that point until he answers. To do this it uses a private event loop: (create modal dialog box) while (answer == RET_NONE || XtAppPending(context)) { XtAppProcessEvent (context, XtIMAll); } (answer is a global which is set by the callbacks of the dlg box) I'm wondering why XtAppPending() is in the while condition. Would this work just as well? while(answer==RET_NONE) { XtAppProcessEvent (context, XtIMAll); } Coral * ** Tom Tulinsky 508 460-6010 * ** Coral Network Corporation fax 508 481-6258 * ** 734 Forest St net: tomt@coral.com *** Marlboro, MA 01752 ** U S A ********* NETWORKS
Dan.Heller@Eng.Sun.COM (Dan Heller) (06/24/91)
On Jun 19, 11:09am, Tom Tulinsky wrote: > In the X Frequently Asked Questions list, no. 106, some code is given > that allows you to query the user at a given point in a program and > not proceed past that point until he answers. To do this it uses a > private event loop: The original code was mine, but pass it around the net a while and it sure doesn't look like what I wrote anymore... :-) anyway... > (create modal dialog box) > while (answer == RET_NONE || XtAppPending(context)) { > XtAppProcessEvent (context, XtIMAll); > } > (answer is a global which is set by the callbacks of the dlg > box) > > I'm wondering why XtAppPending() is in the while condition. Would > this work just as well? > > while(answer==RET_NONE) { > XtAppProcessEvent (context, XtIMAll); > } The XtAppPending() was originally intended to allow the dialog to destroy itself in the callback routine and let the 2 phase destroy operation for widgets complete, generating the resulting Expose events that happen on any of the windows that were obscured by the dialog. The XtAppPending() will catch and process those destroy events so that when this function returns, you know that the user is no longer looking at the dialog ... more of an aesthetic issue than anything else. This is all explained in the upcoming O'Reilly Volume 6, Motif Programmer's Manual due late august or so... Sorry I haven't been very prolific on this mailing list -- I've been hiding out in other lists lately.. -- Dan Heller O'Reilly && Associates Z-Code Software Comp-sources-x: Senior Writer President comp-sources-x@uunet.uu.net argv@ora.com argv@zipcode.com