Path: utzoo!utgpu!watserv1!watmath!iuvax!ux1.cso.uiuc.edu!sp29.csrd.uiuc.edu!hammer From: hammer@sp29.csrd.uiuc.edu (David Hammerslag) Newsgroups: comp.windows.x Subject: Re: Synchronous vs Asynchrounous Message-ID: <1990Feb1.213625.12870@ux1.cso.uiuc.edu> Date: 1 Feb 90 21:36:25 GMT References: <1990Feb1.200702.25274@agate.berkeley.edu> Sender: news@ux1.cso.uiuc.edu (News) Reply-To: hammer@uicsrd.csrd.uiuc.edu Organization: University of Illinois Center for Supercomputing Research and Development Lines: 52 In article <1990Feb1.200702.25274@agate.berkeley.edu>, spanki@color.ced.berkeley.edu (Frank Goodman) writes: > > I read the article about synchronous vs asynchronous, and I have a few > question. I have a popup shell with a label as a child, and I want to > use it for messages to the user. I pop it up in a callback, with a message > like "Loading image, please be patient". However, since it is being poped up > in a callback, and I then go off into a long process of loading an image, my > label widget is never getting the text displayed. I believe, this is because > the expose event is sitting in the Q while I load my image, and not getting > processed while the popup is mapped. I call XFlush right after XtPopup, > but that doesn't do it. How can I ge the text to display? I'm going to want > to use this sort of message system throughout the program, I imagine, I will > need to reset the string (via XtSetValues), as well as move the popup > around. These messages are context specific, and therefore the moving, and > labeling routines will be called from callback routines. How can I get my > text to show? > I faced a similar problem. Here is what I did. (Caveat: it ain't pretty, but is seems to work). If anybody is willing to share a more reasonable solution, I would like to see it. notes: This is all under Motif. standby is an externally defined label XfWorking() { register XEvent event; XtAppContext app = _XtDefaultAppContext(); Widget bboard; Window win; bboard = XtParent(standby); XtManageChild(bboard); /* this pops up the shell */ win = XtWindow(bboard); do /* be XtMainLoop until the bboard gets an expose event */ { XtAppNextEvent(app, &event); XtDispatchEvent(&event); } while ((event.xany.window != win) || (event.type != Expose)); XFlush(XtDisplay(standby)); } ------------------------------------------------------------------------------- David Hammerslag | "Woe to those who are wise in their own hammer@uicsrd.csrd.uiuc.edu | eyes and clever in their own sight." Isaiah 5:21 -------------------------------------------------------------------------------