Path: utzoo!attcan!uunet!lll-winken!ames!think!bloom-beacon!WHARTON.UPENN.EDU!JONES From: JONES@WHARTON.UPENN.EDU Newsgroups: comp.windows.x Subject: Naive Question about Curses, Xt Message-ID: <8902200344.AA10242@remote.dccs.upenn.edu> Date: 20 Feb 89 03:42:00 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 56 Well, I know what I am trying to do is most likely sinful. At best it is a quick and filthy hack. And to top it off I'm a novice user. At any rate, I have a program that currently uses curses to provide primitive screen management. Without changing (too much) the curses code, I wanted to be able to add in other widgets using Xt. Of course the program works fine using xterm, without trying any fancy stuff. After much effort, I was able to get a widget to appear when the program started up under Xterm. The problem I am having concerns making certain both the Widget and Xterm get the appropriate events at the appropriate time. The extra modifications involve calling XtInitialize to set up a top level widget, and appropriate child widgets. Then the code sits in a big loop obtaining individual characters from curses (using getch), and processing appropriately. To include Xt into the loop, I tried replacing the curses getch() function with the following code: int hackgetchar(); { XEvent Ev; char acharstring[1]; int c; XtNextEvent(&Ev); while(Ev.type!=KeyPress) { XtDispatchEvent(&Ev); XtNextEvent(&Ev); } (void) XLookupString(&Ev.xkey,&acharstring,1,NULL,NULL); return((int) acharstring[0]); } From what I can tell, this bit of code never traps a KeyPress event. Am I missing something or is what I'm trying to do impossible? I'm running X11 R2 on an IBM RT running AIX version 2.2.1. Chris Jones The Wharton School The University of Pennsylvania Philadelphia, PA 19104 JONES@WHARTON.UPENN.EDU