Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!eureka!argv From: argv%eureka@Sun.COM (Dan Heller) Newsgroups: comp.windows.x Subject: Re: probs with popup windows Message-ID: <103531@sun.Eng.Sun.COM> Date: 8 May 89 01:00:42 GMT References: <2461@lll-lcc.UUCP> <8905051611.AA10212@expo.lcs.mit.edu> Sender: news@sun.Eng.Sun.COM Reply-To: argv@sun.com (Dan Heller) Organization: Island Graphics Corporation, Marin County, CA. Lines: 44 I thought I followed up to this before; maybe it didn't get thru. In article kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) writes: > > I'm having great difficulty getting things to work as stated above. > It sounds like you are having problems with your program flow. What you > need to do is: > > 1) When this user selects display popup the dialog widget, and then return from > the routine. > > This will return you to XtMainLoop() which will process events and > popup the dialog widget. You shouldn't *have* to return to the top level. This might change the flow of the program or function significantly. It is perfectly reasonable to want to "freeze" the program and interact with the user immediately. Obviously, this easily handled by inserting a synthetic XtMainLoop() in the function which does the popup and is prompting for request to return (see prompt.c in WidgetWrap source). > It is important to remember that no event processing will happen when > the program is actually in a callback or action routine, all event processing > and window operations take place when the program is in the XtMainLoop() In the general sense this is true, but it doesn't have to be; the user should be able to loop himself as exemplified in the above paragraph. As I said, prompt.c shows an example of this, but it also raises and interesting question which was discussed several months ago, but nothing was resolved. Is XtNextEvent and XtDispatchEvent reentrant? Experimentation on various machines renders no particular problems with it. Inspection of the source doesn't show any particular problems with it (so long as you aren't reentrant as a result of servicing a signal of some kind that interrupted the intrinsics at an undesireable place). Paul Ascente once answered "kind of" meaning (based on my understanding of what he said at the time) that you may call XtNextEvent and XtDispatch... as long as "you are careful" -- that is, don't set your -own- timer (e.g. you're not using XtAddTimeOut) and suddenly call Xt{Next,Dispatch}Event and expect it to work. If you understand the toolkit intrinsics, you can figure out when is a reasonable time to call your own such routine (again, I refer you back to prompt.c). dan