home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!timkwan
- From: timkwan@athena.mit.edu (Unknown)
- Newsgroups: comp.windows.x.motif
- Subject: Resetting radiobuttons with new pixmaps
- Message-ID: <1992Aug22.111856.16746@athena.mit.edu>
- Date: 22 Aug 92 11:18:56 GMT
- Sender: news@athena.mit.edu (News system)
- Organization: Massachusetts Institute of Technology
- Lines: 87
- Nntp-Posting-Host: w20-575-79.mit.edu
-
-
- Help! I create pushbuttons on the fly according to some user
- response. Each pushbutton has the same activate callback. The
- callback function opens a dialog box (created only once and kept around
- for the duration of the program) which has 5 radiobuttons:
-
- static Widget dialog = NULL;
-
- if (!dialog) {
- dialog = XmCreateFormDialog(theAppData.inputShell, "branchParam", NULL, 0);
- :
- :
- :
- radiobox = XmCreateRadioBox(frame, "radiobox", NULL, 0);
-
- for (i = 0; i < 5; i++) {
- sprintf(s, "radio%d", i);
- radiobtn[i] = XtVaCreateManagedWidget(s,
- xmToggleButtonWidgetClass, radiobox,
- XmNlabelType, XmPIXMAP,
- NULL);
- XtAddCallback(radiobtn[i], XmNvalueChangedCallback,
- DoSelectBranchType, i);
- :
- :
- :
- }
- }
-
- XtManageChild(radiobox);
-
- /* The following looks verbose and redundant but I see no reason why
- it won't work as I expect it to. */
-
- XtVaSetValues(radiobox, XmNradioAlwaysOne, False, NULL);
- XFlush(XtDisplay(w));
-
- for (i = 0; i < 5; i++)
- XtVaSetValues(radiobtn[i],
- XmNset, True, /* Set ALL radiobuttons to 'selected' state */
- NULL);
- XFlush(XtDisplay(w));
-
- for (i = 0; i < 5; i++)
- XtVaSetValues(radiobtn[i],
- XmNselectPixmap, toolPix[currentDomain][i],
- NULL);
- XFlush(XtDisplay(w));
-
- for (i = 0; i < 5; i++)
- XtVaSetValues(radiobtn[i],
- XmNset, False, /* Set ALL radiobuttons to 'UNselected' state */
- NULL);
- XFlush(XtDisplay(w));
-
- for (i = 0; i < 5; i++)
- XtVaSetValues(radiobtn[i],
- XmNunselectPixmap, toolPix[currentDomain][i],
- NULL);
- XFlush(XtDisplay(w));
-
- XtVaSetValues(XtParent(radiobtn[0]), XmNradioAlwaysOne, True, NULL);
- XFlush(XtDisplay(w));
-
- -------------
-
- The problem is the first time the dialog box is opened, all the radio
- buttons have their respective pixmaps that are each the same whether
- it is selected or unselected. This is the desired effect.
-
- But susequent openings of the same dialog box shows the radiobuttons
- to have the SAME pixmaps even tho 'currentDomain' is different. But
- then clicking on EACH radiobutton will show that its OTHER pixmap is
- in fact the new pixmap that was assigned to it according to the value
- of 'currentDomain'. E.g. let's say when the dialog box is first
- opened, the pixmaps are A,B,C,D, and E for both selected and
- unselected states (which is what I want). Then on the next (and
- subsequent) openings of the same dialog box, I see the same A,B,C,D,
- and E pixmaps, but as I toggle each radiobutton in turn, I see the new
- F,G,H,I, and J pixmaps.
-
- Why is that? How do I RESET the radiobuttons with new pixmaps that
- are the same for both states?
-
- Please respond to me directly via email. Thanks.
-
- -Tim
-