Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!seismo!hal!nancie From: nancie@hal.CSS.GOV (Nancie Matson) Newsgroups: comp.windows.x Subject: Event Loops (Using XtMainLoop and XtNextEvent) Message-ID: <452@hal.CSS.GOV> Date: 30 Aug 90 14:19:39 GMT Reply-To: nancie@hal.css.gov (Nancie Matson) Organization: ENSCO Inc., Melbourne FL Lines: 63 I am trying to implement an event loop in my Xt application, (in addition to XtMainLoop) to capture input from a list of popup toggle widgets. I am using XtNextEvent to retrieve the next event on the queue, and them I am testing it to see if it is one of the widgets I am looking for. The problem I get occurs before the Event Loop is executed. Whatever I try to do immediately before this EventLoop, doesn't get executed. For example, if I want to display a message to the user by changing a label widget, and then execute the Event Loop, I never see the message on the screen. I know this has to do with the server not recieving the last event on the queue (XtMainLoop's queue), but I tried using XFlush, and XSync before executing my event loop with no luck. The following is a sample of my event Loop. ------- strcpy(label,"Select an Event with the mouse."); XtSetArg (args[0],XtNlabel,label); XtSetValues(status,args,1); while (!done) { XtNextEvent(&event); if (event.type == ButtonPress) { if (((event.xbutton.button == Button1) || (event.xbutton.button == Button2) || (event.xbutton.button == Button3)) && (event.xbutton.window == XtWindow(evnt.data[j].esym))) { point = Project (1,map.proj->id,evnt.data[j].loc,0); loc->x = (int)point.xlon; loc->y = (int)point.ylat; done = 1; *index = j; } } } strcpy(label,"Mouse Ready ..."); XtSetArg (args[0],XtNlabel,label); XtSetValues(status,args,1); ---------- The first call to XtSetValues doesn't appear on the screen, but the second one does. Is there any way to ensure that events/server requests placed on the queue before a call to XtNextEvent get executed? Any info would be helpful. SO far I've tried using XtFlush, XtSync and even XtDispatchEvent. Please e-mail to nancie@hal.CSS.GOV. I will post a summary if anyone is interested. -Nancie P. Matson ENSCO, Inc. nancie@hal.CSS.GOV