tsai@Veritas.COM (Cary Tsai) (01/11/91)
I want to destroy a dialog window from its "Cancel" button, I got core dump all the time. Could any one tell me what's wrong with the following proc. /* compile this program with MOTIF 1.1 */ #include <stdio.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <Xm/Xm.h> #include <Xm/Form.h> #include <Xm/PushB.h> void newWin(), closeCB(); void closeCB(w, client, data) Widget w; Widget client; caddr_t data; { XtDestroyWidget(client); } main(argc, argv) int argc; char **argv; { Widget top, b1; top = XtInitialize(argv[0], "Ask", NULL, 0, &argc, argv); b1 = XtCreateManagedWidget("Push me to create a dialog box", xmPushButtonWidgetClass, top, NULL, 0); XtAddCallback(b1, XmNactivateCallback, newWin, top); XtRealizeWidget(top); XtMainLoop(); } void newWin(w, client, data) Widget w; caddr_t client; caddr_t data; { Widget top, b1, parent=(Widget) client; top = XmCreateFormDialog(w, "New Window", NULL, 0); b1 = XtCreateManagedWidget("Push me to close this box", xmPushButtonWidgetClass, top, NULL, 0); XtAddCallback(b1, XmNactivateCallback, closeCB, top); XtManageChild(top); } /* end */
nazgul@alphalpha.com (Kee Hinckley) (01/13/91)
In article <1991Jan10.231010.5189@Veritas.COM> tsai@Veritas.COM (Cary Tsai) writes: > >I want to destroy a dialog window from its "Cancel" button, I got core dump >all the time. Could any one tell me what's wrong with the following proc. Nothing that I can tell. It works fine with my version of Motif 1.1. But then, I've made dozens of patches to it, including a number of things having to do with deleting widgets. Motif source - don't leave home without it. -- Alfalfa Software, Inc. | motif-request@alfalfa.com nazgul@alfalfa.com |----------------------------------- 617/646-7703 (voice/fax) | Proline BBS: 617/641-3722 I'm not sure which upsets me more; that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.