Path: utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!quagga!ucthpx!uctcs!gram From: gram@uctcs.uucp (Graham Wheeler) Newsgroups: comp.windows.x Subject: AsciiText widget problem Keywords: Xaw, Xt, Editors, X, windows Message-ID: <756@ucthpx.UUCP> Date: 25 Sep 90 13:03:57 GMT Sender: news@ucthpx.UUCP Lines: 49 I have (yet another) problem with X. I am trying to write a simple program to behave as a file browser/editor. I was very pleased when I read that the AsciiText widget (Athena) supports editing. Unfortunately the only docs I have are the MIT distribution docs, which are really references for those who already know how to do these things. I also no longer have the source code for the Athena widget examples. My program is appended below. The aim is to display/edit the file specified on the command line, or open a file "Noname.est" if none is specified. If I run with no arguments, I get a "File or directory not found" error. Fair enough. If I specify a file name of an existing file (with or without quotes) I just get the file name displayed followed by a number of ^@'s. I cannot edit this display. Although the search widget pops up when I hit Ctrl-S, I cannot get the AsciiWidget to recognise the META key (which I presume is ESC or Ctrl-X). Note that there are two problems described here: displaying the file *contents*, and using META key sequences. I am running X11R4 on a SPARCstation 1+. Any ideas, anyone? Please E-mail. The program is: #include #include #include main(argc,argv) int argc; char *argv[]; { Widget toplevel, EdWinWidget; Arg wargs[10]; int n=0; /* arg count */ /* Initialise intrinsics and create top-level shell widget */ toplevel = XtInitialize(argv[0],"Xpew", NULL, 0, &argc, argv); /* Specify the file to be displayed */ XtSetArg(wargs[n], "type", "XawAsciiFile"); n++; if (argc==2) XtSetArg(wargs[n], "string", argv[1]); else XtSetArg(wargs[n], "string", "Noname.est"); n++; /* Create the widget */ EdWinWidget = XtCreateManagedWidget("Editor",asciiTextWidgetClass, toplevel, wargs, n); /* Realise the widgets, and enter event loop */ XtRealizeWidget(toplevel); XtMainLoop(); } Graham Wheeler | Dept. of Computer Science | Internet: University of Cape Town | BANG: <...uunet!ddsw1!olsa99!uctcs!gram>