[comp.windows.x] Athena Toggle Radio Group Question

jcarson@WILKINS.BCM.TMC.EDU (Janet L. Carson) (05/26/90)

I am having some problems with the Athena toggle widget in a radio
group.  I have successfully created radio groups where I have been
able to specify the radio group at the time the widgets are being
created.  However, I have a situation where I need to be able to
set up a radio group "on the fly."  I'm using WsXc to generate my
widget tree for me, (saves a *lot* of C coding!) and I want to set
the radio group from the createCallback.  A short test program to 
illustrate my problem is below.  Why won't these toggles function
as a radio group?

Janet L. Carson                               internet: jcarson@bcm.tmc.edu 
Baylor College of Medicine              uucp: {rutgers,mailrus}!bcm!jcarson


------------------------ cut here for app defaults file ---------------

*Toggle.translations: \
<EnterWindow>: highlight(Always) \n \
<LeaveWindow>: unhighlight() \n \
<Btn1Down>,<Btn1Up>: set() notify()

------------------------ cut here for code  ---------------------------

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>

#include <X11/Xaw/Box.h>
#include <X11/Xaw/Toggle.h>

main(argc,argv)
   int argc;
   char *argv[];
{
    Widget toplevel, box, toggles[3];
    XtAppContext app_con;
    int j;

    toplevel = XtAppInitialize(&app_con, "Testme", NULL, 0,
         &argc, argv,
         NULL,
         NULL, 0);

    box = XtCreateWidget("box", boxWidgetClass, toplevel, NULL, 0);

    for (j = 0; j < 3; j++)
      toggles[j] = XtCreateWidget("toggle", toggleWidgetClass, box, NULL, 0);

    for (j = 1; j < 3; j++)
	    XawToggleChangeRadioGroup(toggles[j], toggles[0]);

    XtManageChild(box);
    XtManageChildren(toggles, 3);
    XtRealizeWidget(toplevel);
    XtAppMainLoop(app_con);

}

converse@EXPO.LCS.MIT.EDU (Donna Converse) (06/01/90)

> I am having some problems with the Athena toggle widget in a radio
> group.  I have successfully created radio groups where I have been
> able to specify the radio group at the time the widgets are being
> created.  However, I have a situation where I need to be able to
> set up a radio group "on the fly."
.....

> Why won't these toggles function
> as a radio group?


Bug in XawToggleChangeRadioGroup: when the second argument is a widget
which doesn't belong to any radio group; i.e. the bug is when this 
function is used to create a new radio group -- no new group is created.
A work-around is to first create the group by changing a widget's 
radio group to be itself, then using the function normally.


Donna Converse
converse@expo.lcs.mit.edu