marzano@hpfcdj.HP.COM (Lou Marzano) (08/25/89)
I've created an application that brings up a dialog box upon selection of one of the popup menu buttons. The dialog box consists of three staticText widgets, two textEdit widgets, and two buttons. When one of the buttons is selected, a callback routine is invoked. This callback tries to modify the text displayed in one of the staticText widgets. All of the widgets described above are declared as global veriables. The problem I'm having is that when I call XtSetValues() to change the string displayed in the staticText widget, the widget dies. Is there any reason why I shouldn't be able to change the attributes of a widget which is the child of a transientShell (my popup shell) from a menu button callback? Here's some of the code: /**********************************/ /**** Callback Functions **********/ /**********************************/ void start_testing (w, client_data, call_data) Widget w; caddr_t client_data, call_data; { int k, try = 0; char string[80]; enum boolean unit_found; Arg sargs[15]; printf ("start testing\n"); if ( valid_wo_flag == true ) { set_selects (rdpy, &unit_found); if (unit_found == false) printf ("unit_found is false\n"); else if (unit_found == true) printf ("unit_found is true\n"); else printf ("unit_found is unknown: %d\n", unit_found); while ( unit_found == false) { /** pop up error box **/ printf ("try: %d\n", try); set_selects (rdpy, &unit_found); sleep (10); try++; k = 0; XtSetArg (sargs[k], XtNstring, "Hell"); k++; XtSetValues (gwoSt2, (ArgList)sargs, k); XFlush (ldpy); } /* while */ XtCallCallbacks (gwoNO, XtNrelease, NULL); } /* if */ } /**** * This is how I create the popup dialog box ****/ n = 0; XtSetArg (args[n], XtNallowShellResize, TRUE); n++; gwo_wids.popupShell = XtCreatePopupShell ("gwoSh1", transientShellWidgetClass, flb1, (ArgList)args, n); n = 0; gwoForm = XtCreateManagedWidget ("gwoForm", XwformWidgetClass, gwo_wids.popupShell, (ArgList)args, n); n = 0; XtSetArg (args[n], XtNwidth, (Dimension)250); n++; XtSetArg (args[n], XtNheight, (Dimension)30); n++; XtSetArg (args[n], XtNxAttachRight, TRUE); n++; XtSetArg (args[n], XtNxResizable, TRUE); n++; XtSetArg (args[n], XtNfont, (XtArgVal)font3); n++; XtSetArg (args[n], XtNstring, "Enter Work Object number"); n++; gwoSt1 = XtCreateManagedWidget ("gwoSt1", XwstaticTextWidgetClass, gwoForm, (ArgList)args, n); XtAddActions (wodbActionsTable, XtNumber(wodbActionsTable)); trans_table = XtParseTranslationTable (wodbTranslations); n = 0; XtSetArg (args[n], XtNwidth, (Dimension)250); n++; XtSetArg (args[n], XtNheight, (Dimension)30); n++; XtSetArg (args[n], XtNyRefWidget, (caddr_t)gwoSt1); n++; XtSetArg (args[n], XtNyAddHeight, TRUE); n++; XtSetArg (args[n], XtNyOffset, 5); n++; XtSetArg (args[n], XtNxAttachRight, TRUE); n++; XtSetArg (args[n], XtNxResizable, TRUE); n++; XtSetArg (args[n], XtNeditType, XwtextEdit); n++; gwo_wids.textEdit[0] = XtCreateManagedWidget("gwoTe0", XwtexteditWidgetClass, gwoForm, (ArgList)args, n); XtOverrideTranslations (gwo_wids.textEdit[0], trans_table); n = 0; XtSetArg (args[n], XtNfont, &fontptr); n++; /* get font used by widget */ XtGetValues (gwo_wids.textEdit[0], (ArgList)args, n); n = 0; XtSetArg (args[n], XtNheight, FONTHEIGHT(fontptr) + 6); n++; /* set widget */ XtSetValues (gwo_wids.textEdit[0], (ArgList)args, n); /* height by font */ n = 0; XtSetArg (args[n], XtNwidth, (Dimension)250); n++; XtSetArg (args[n], XtNheight, (Dimension)30); n++; XtSetArg (args[n], XtNyRefWidget, (caddr_t)gwo_wids.textEdit[0]); n++; XtSetArg (args[n], XtNyAddHeight, TRUE); n++; XtSetArg (args[n], XtNyOffset, 10); n++; XtSetArg (args[n], XtNxAttachRight, TRUE); n++; XtSetArg (args[n], XtNxResizable, TRUE); n++; XtSetArg (args[n], XtNfont, (XtArgVal)font3); n++; XtSetArg (args[n], XtNstring, "Enter Location of UUT"); n++; gwoSt2 = XtCreateManagedWidget ("gwoSt2", XwstaticTextWidgetClass, gwoForm, (ArgList)args, n); XtAddActions (locActionsTable, XtNumber(locActionsTable)); trans_table = XtParseTranslationTable (locTranslations); n = 0; XtSetArg (args[n], XtNwidth, (Dimension)250); n++; XtSetArg (args[n], XtNheight, (Dimension)30); n++; XtSetArg (args[n], XtNyRefWidget, (caddr_t)gwoSt2); n++; XtSetArg (args[n], XtNyAddHeight, TRUE); n++; XtSetArg (args[n], XtNyOffset, 5); n++; XtSetArg (args[n], XtNxAttachRight, TRUE); n++; XtSetArg (args[n], XtNxResizable, TRUE); n++; XtSetArg (args[n], XtNeditType, XwtextEdit); n++; gwo_wids.textEdit[1] = XtCreateManagedWidget("gwoTe1", XwtexteditWidgetClass, gwoForm, (ArgList)args, n); XtOverrideTranslations (gwo_wids.textEdit[1], trans_table); n = 0; XtSetArg (args[n], XtNfont, &fontptr); n++; /* get font used by widget */ XtGetValues (gwo_wids.textEdit[1], (ArgList)args, n); n = 0; XtSetArg (args[n], XtNheight, FONTHEIGHT(fontptr) + 6); n++; /* set widget */ XtSetValues (gwo_wids.textEdit[1], (ArgList)args, n); /* height by font */ n = 0; XtSetArg (args[n], XtNwidth, (Dimension)100); n++; XtSetArg (args[n], XtNheight, (Dimension)50); n++; XtSetArg (args[n], XtNyRefWidget, (caddr_t)gwo_wids.textEdit[1]); n++; XtSetArg (args[n], XtNyAddHeight, TRUE); n++; XtSetArg (args[n], XtNyOffset, 10); n++; gwoOK = XtCreateManagedWidget ("gwoOK", XwpushButtonWidgetClass, gwoForm, (ArgList)args, n); n = 0; XtSetArg (args[n], XtNwidth, (Dimension)100); n++; XtSetArg (args[n], XtNheight, (Dimension)50); n++; XtSetArg (args[n], XtNxRefWidget, (caddr_t)gwoOK); n++; XtSetArg (args[n], XtNyRefWidget, (caddr_t)gwoOK); n++; XtSetArg (args[n], XtNxAddWidth, TRUE); n++; XtSetArg (args[n], XtNxAttachRight, TRUE); n++; XtSetArg (args[n], XtNxVaryOffset, TRUE); n++; gwoNO = XtCreateManagedWidget ("gwoNO", XwpushButtonWidgetClass, gwoForm, (ArgList)args, n); n = 0; XtSetArg (args[n], XtNwidth, (Dimension)250); n++; XtSetArg (args[n], XtNheight, (Dimension)30); n++; XtSetArg (args[n], XtNyRefWidget, (caddr_t)gwoOK); n++; XtSetArg (args[n], XtNyAddHeight, TRUE); n++; XtSetArg (args[n], XtNyOffset, 5); n++; XtSetArg (args[n], XtNxAttachRight, TRUE); n++; XtSetArg (args[n], XtNxResizable, TRUE); n++; XtSetArg (args[n], XtNfont, (XtArgVal)font3); n++; gwoSt3 = XtCreateManagedWidget ("gwoSt3", XwstaticTextWidgetClass, gwoForm, (ArgList)args, n); Thanks in advance, Lou Marzano