Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!ATHENA.MIT.EDU!swick From: swick@ATHENA.MIT.EDU (Ralph R. Swick) Newsgroups: comp.windows.x Subject: Re: Writing error messages to a text window Message-ID: <8811011444.AA02208@LYRE.MIT.EDU> Date: 1 Nov 88 14:44:51 GMT References: <8810312356.AA22075@hub.ucsb.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: DEC/MIT Project Athena Lines: 67 Here's a quick hack to examples/Xaw/xcommand.c; embellish (or discard) as your heart desires :-) *** /u1/X/src/examples/Xaw/xcommand.c Fri Feb 26 00:28:01 1988 --- popup.c Tue Nov 1 09:14:39 1988 *************** *** 1,6 **** --- 1,9 ---- #include #include #include + #include + #include + #include static XrmOptionDescRec options[] = { {"-label", "*label", XrmoptionSepArg, NULL} *************** *** 12,18 **** --- 15,42 ---- fprintf( stderr, "Usage: %s\n", call ); } + void ErrorPopup(parent, text) + Widget parent; + String text; + { + Arg args[4]; + Position x, y; + Dimension w, h; + Widget popup; + XtSetArg( args[0], XtNwidth, &w ); + XtSetArg( args[1], XtNheight, &h ); + XtGetValues( parent, args, TWO ); + XtTranslateCoords( parent, (Position)w/2, (Position)h/2, &x, &y ); + XtSetArg( args[0], XtNx, x ); + XtSetArg( args[1], XtNy, y ); + popup = XtCreatePopupShell( "error", transientShellWidgetClass, + parent, args, TWO ); + XtSetArg( args[0], XtNlabel, text ); + XtCreateManagedWidget( "text", labelWidgetClass, popup, args, ONE ); + XtPopup(popup, XtGrabNone); + } + /* ARGSUSED */ void Activate(w, closure, call_data) Widget w; *************** *** 19,27 **** caddr_t closure; caddr_t call_data; { ! printf( "button was activated.\n" ); } - void main(argc, argv) unsigned int argc; --- 43,50 ---- caddr_t closure; caddr_t call_data; { ! ErrorPopup( w, "button was activated" ); } void main(argc, argv) unsigned int argc;