Newsgroups: comp.windows.x.motif Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!ghost.unimi.it!borgato From: borgato@ghost.unimi.it (Andrea Borgato) Subject: Problem with XmSelectionBox Message-ID: <1991Jun11.185821.7814@ghost.unimi.it> Keywords: XmSelectionBox, Cancel Button, Imput Focus. Organization: Computer Science Dep. - Milan University Date: Tue, 11 Jun 1991 18:58:21 GMT Lines: 135 Hi, I'm Andrea Borgato from Milano Italy and I'm GUI developer. I've a little bit problem with XmSelectionBox. The problem is following: During interaction between user and my application, when user chooses a particular menu item that shows Selection Box where *cancel button* set as default button; selects item from list and press return key my application print a X error something like follow: ??? X failed request X_FillPolygon Bad Drawable ??? Below there is a code fragment that creates a XmSelectionBox in my application. I hope somebody will have any suggestions or solutions about my problem. -- Andrea Borgato Phone: +39-2-26162-233 Etnoteam S.p.A. Phone: +39-2-26162-234 Via Adelaide Bono Cairoli 34 E-mail: borgato@ghost.unimi.it 20126 Milano Italy E-mail: andrea@etnomi.UUCP -------------------------- Code Source --------------------------------- /* * @(#) Etnoteam S.p.A.: HfLooknFeel Library. * @(#) * @(#) SelectPane.c - It contains functions for creating and manage * @(#) selection panel * @(#) * @(#) By Andrea Borgato Milano, Mar. 12th 1991. */ /* * System Includes */ #include #include #include #include /* * User Includes */ #include /* * This function creates, sets item list and shows the selection panel */ void XhflfShowSelectPane(nitems, listitems, Func, Name) int nitems; char *listitems[]; void (*Func)(); char *Name; { Arg args[10]; register int n; int i; XmString *list; XmString sel; Widget selectpane; Widget cancelbutton; Widget textitem; XmString MTitle; /* * Create Dialog Title */ MTitle = XmStringCreate(Name, XmSTRING_DEFAULT_CHARSET); /* * Create SelectionDialog */ n = 0; XtSetArg(args[n], XmNdialogTitle, MTitle); n++; XtSetArg(args[n], XmNautoUnmanage, False); n++; XtSetArg(args[n], XmNdialogStyle, XmDIALOG_SYSTEM_MODAL); n++; selectpane = XmCreateSelectionDialog(_HFTopLevel, "selectpane", args, n); /* * Unmanage Apply Button */ XtUnmanageChild(XmSelectionBoxGetChild(selectpane, XmDIALOG_APPLY_BUTTON)); /* * Set the default Button */ cancelbutton = XmSelectionBoxGetChild(selectpane, XmDIALOG_CANCEL_BUTTON); n = 0; XtSetArg(args[n], XmNdefaultButton, cancelbutton); n++; XtSetValues(selectpane, args, n); /* * Set Max length of Text field */ textitem = XmSelectionBoxGetChild(selectpane, XmDIALOG_TEXT); n = 0; XtSetArg(args[0], XmNmaxLength, 13); n++; XtSetValues(textitem, args, n); XtAddCallback(selectpane, XmNokCallback, SPokCB, Func); XtAddCallback(selectpane, XmNcancelCallback, SPcancelCB, Func); /* * Convert items list from char to XmString */ list = (XmString *)XtMalloc(sizeof(XmString) * nitems); for (i = 0; i < nitems; i++) list[i] = XmStringCreate(listitems[i], XmSTRING_DEFAULT_CHARSET); /* * Set list of items */ sel = XmStringCreate(Selection, XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(args[n], XmNlistItemCount, nitems); n++; XtSetArg(args[n], XmNlistItems, list); n++; XtSetArg(args[n], XmNtextString, sel); n++; XtSetValues(selectpane, args, n); /* * Show selection panel */ XtManageChild(selectpane); } ------------------------------------------------------------------------------ -- Andrea Borgato Phone: +39-2-26162-233 Etnoteam S.p.A. Phone: +39-2-26162-234 Via Adelaide Bono Cairoli 34 E-mail: borgato@ghost.unimi.it 20126 Milano Italy E-mail: andrea@etnomi.UUCP