Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!cbmvax!vu-vlsi!daniel From: daniel@vu-vlsi.Villanova.EDU (Daniel C. Gnanaprakasam) Newsgroups: comp.windows.x Subject: Beginner's prblem with widgets Keywords: widgets, toolkit Message-ID: <2200@vu-vlsi.Villanova.EDU> Date: 15 Feb 89 00:47:15 GMT Organization: Villanova Univ. EE Dept. Lines: 68 I am a novice user of X toolkit and I am having problems getting my first program to work. The X11 R2 server is running on a Sun 3/50 under 4.0 OS. The program I tried was the one given in the paper titled "Using the X Toolkit or How to Write a Widget", by Joel McCormack and Paul Asente. ( Usenix Conference Summer 1988 ). The following is the program I tried. /** ------------------------------------------------------- */ #include #include #include #include #include #include void Callback(widget,clientData,callData) Widget widget; caddr_t clientData, callData; { (void) printf("Goodbye, cruel world \n"); exit(0); } int main(argc,argv) unsigned int argc; char **argv; { Widget toplevel,box,label,command; Arg arg[25]; unsigned int n; toplevel = XtInitialize("goodbye","Goodbye",NULL,0,&argc,argv); box = XtCreateManagedWidget("box",formWidgetClass,toplevel,(Arg *)NULL,0); n=0; XtSetArg(arg[n],XtNx,10); n++; XtSetArg(arg[n],XtNy,10); n++; XtSetArg(arg[n],XtNlabel,"Goodbye world"); n++; label = XtCreateManagedWidget("label",labelWidgetClass,box,arg,n); n=0; XtSetArg(arg[n],XtNx,50); n++; XtSetArg(arg[n],XtNy,40); n++; XtSetArg(arg[n],XtNlabel,"Click and die"); n++; command = XtCreateManagedWidget("command",commandWidgetClass,box,arg,n); XtAddCallback(command,XtNcallback,Callback,NULL); XtRealizeWidget(toplevel); XtMainLoop(); } /** ------------------------------------------------------ **/ I compiled and linked by cc -o xtk xtk.c -lXaw -lXt -lX When I run it, only the label widget with the label "Goodbye label" appears on the display. Thanks for the help daniel