howard@caen.engin.umich.edu (MILTON GILBERT HOWARD III) (12/01/89)
I am a begining X programmer and am having trouble getting a simple
program running using the HP X widget set's TextEdit widget with a
disk file as it's source. I simply want to create a scrolled window
with a TextEdit widget as its child for editing. Below is the code
for the simple program that dumps core when run. Any HELP would be
grately appreciated (suggestions, sample code especially)!
I am using a DECstation 3100 with DEC's native X server -- nothing fancy.
Please respond by e-mail to: howard@caen.engin.umich.edu (Internet)
---------------------------------- CUT HERE -------------------------------
#include <stdio.h>
/* library includes */
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xw/Xw.h>
#include <Xw/TextEdit.h>
#include <Xw/Valuator.h>
#include <Xw/Arrow.h>
#include <Xw/ScrollBar.h>
#include <Xw/SWindow.h>
main(argc,argv)
int argc;
char *argv[];
{
Widget scroll_window;
Widget toplevel;
int i;
Arg wargs[7];
toplevel = XtInitialize(argv[0],"Test",NULL,0,&argc,argv);
i = 0;
XtSetArg(wargs[i],XtNforceVerticalSB,TRUE); i++;
scroll_window = XtCreateManagedWidget("swindow", XwswindowWidgetClass, toplevel, wargs, i);
i = 0;
/* Don't set XtNfile resource. Use default temporary file */
XtSetArg(wargs[i],XtNeditType,XwtextAppend); i++;
XtSetArg(wargs[i],XtNsourceType,XwdiskSrc); i++;
XtSetArg(wargs[i],XtNforceVerticalSB,TRUE); i++;
XtSetArg(wargs[i],XtNwidth,300); i++;
XtSetArg(wargs[i],XtNheight,300); i++;
XtCreateManagedWidget("output_window", XwtexteditWidgetClass, scroll_window, wargs, i);
XtRealizeWidget(toplevel);
XtMainLoop();
}
/*
Milton Howard
howard@caen.engin.umich.edu
*/