Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!mailrus!uflorida!mephisto!mcnc!duke!macbeth!pusateri From: pusateri@macbeth.cs.duke.edu (Thomas J. Pusateri) Newsgroups: comp.windows.x Subject: Athena asciiDisk Widget Keywords: athena widget Message-ID: <16330@duke.cs.duke.edu> Date: 4 Dec 89 19:38:23 GMT Sender: news@duke.cs.duke.edu Lines: 107 Note: I am resending this since because I don't think it worked the first time about a week ago. I thought I finally figured out the Athena Text widgets and so I wrote this short program which should act like an editor. It uses the asciiDiskWidgetClass. However, the program will not let me input any text from the keyboard. It just beeps at me. Its not a problem with keyboard focus. Any one have any helpful hints? I have compiled the following program on a sun3 and a sun4 (OS 4.0.3). Tom Pusateri pusateri@nbsr.duke.edu ---------------------- Cut Here ------------------------------------- #include /* C standard I/O library */ #include /* X toolkit initrinsics */ #include /* X String definitions */ #include /* X top level shell definitions */ #include /* X type definitions */ #include /* Athena form widget defs */ #include /* Athena command widget defs */ #include /* More Athena text widget defs */ #ifndef lint static char RCSid[]= "$Id: test.c,v 1.1 89/11/28 17:29:55 pusateri Exp $"; #endif main(argc, argv) int argc; char *argv[]; { void quit_callback(); /* quit command button event handler */ char Temporary[16]; /* name of temporary text widget file */ FILE *fp; /* text widget temporary file */ unsigned int n; Arg arg[20]; Widget toplevel, form, annot, quit; (void) strcpy(Temporary, "tmpfile"); if ((fp=fopen(Temporary,"w")) == NULL) { fprintf(stderr,"%s: unable to open %s\n",argv[0],Temporary); exit(1); } (void) fclose(fp); /* initialize X Display */ toplevel = XtInitialize(NULL, "testing", NULL, ZERO, &argc, argv); n = 0; XtSetArg(arg[n], XtNinput, True); n++; XtSetValues(toplevel, arg, n); form = XtCreateManagedWidget("form",formWidgetClass, toplevel,(Arg *)NULL,0); n = 0; /* display annotation */ XtSetArg(arg[n], XtNheight, (Dimension) 200); n++; XtSetArg(arg[n], XtNwidth, (Dimension) 500); n++; XtSetArg(arg[n], XtNfile, Temporary); n++; XtSetArg(arg[n], XtNeditType, XttextEdit); n++; XtSetArg(arg[n], XtNtextOptions, editable|scrollVertical|wordBreak|scrollOnOverflow); n++; annot = XtCreateManagedWidget("annot", asciiDiskWidgetClass, form, arg, n); n = 0; /* quit command button */ XtSetArg(arg[n], XtNvertDistance, 20); n++; XtSetArg(arg[n], XtNfromVert, annot); n++; XtSetArg(arg[n], XtNhorizDistance, 250); n++; XtSetArg(arg[n], XtNfromHoriz, NULL); n++; XtSetArg(arg[n], XtNlabel, "Quit"); n++; quit=XtCreateManagedWidget("quit", commandWidgetClass, form,arg,n); XtAddCallback(quit, XtNcallback, quit_callback,(caddr_t) toplevel); XtRealizeWidget(toplevel); XtMainLoop(); /* let X windows process events */ } void quit_callback(widget, clientData, callData) Widget widget; /* unused */ caddr_t clientData; /* toplevel */ caddr_t callData; /* unused */ { Widget toplevel = (Widget) clientData; XtUnmapWidget(toplevel); exit(0); } /* Thomas Pusateri pusateri@nbsr.duke.edu */