Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!purdue!bu-cs!bloom-beacon!ardent.UUCP!mlp From: mlp@ardent.UUCP (Mark Patrick) Newsgroups: comp.windows.x Subject: problem with X toolkit example Message-ID: <8807112154.AA27646@gr.ardent.com> Date: 11 Jul 88 21:54:38 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 61 The following example taken from the paper "Using the X Toolkit or How to Write a Widget" by Joel McCormack and Paul Asente appears to have a problem on the X toolkit implementations (including the sun) which we have access to. The program is given below: #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); n = 0; box = XtCreateManagedWidget("box", formWidgetClass, toplevel, arg, n); 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, 10);n++; XtSetArg(arg[n], XtNy, 40);n++; XtSetArg(arg[n], XtNfromVert, label); n++; XtSetArg(arg[n], XtNlabel, "Click and die");n++; command = XtCreateManagedWidget("command", commandWidgetClass, box, arg, n); XtAddCallback(command, XtNcallback, Callback, NULL); XtRealizeWidget(toplevel); XtMainLoop(); } The line which reads: XtSetArg(arg[n], XtNfromVert, label); n++; appears to be essential for the command widget to be displayed. Does anyone know if this line really should be there of if there is a problem with the X toolkit Mark Patrick Ardent Computer uunet!ardent!mlp