[comp.windows.x] Xt toggle widget problem...

morreale@bierstadt.scd.ucar.edu (Peter Morreale) (05/03/91)

I need some help from a kind Xt programmer out there.....

I'm trying to implment a "zero, or one of many" policy on 3 toggle
widgets.  The toggles work, except that I can get "many" set. :-(
I must have only zero or one toggle set. 

I previously implemented this as a "one of many" policy which worked fine.  
Now I need to force the user to choose one and only one.

What happens with the code below is that I can set one toggle, then set
another toggle *without* the previous toggle being unset.

Here is the relevent code.  What am I doing wrong?

Thanks for any and all help...


	XtTranslations	RadioTranslations, ContactTranslations;
	String		TransTable2 =
			"<EnterWindow>:		highlight(Always)\n\
			<LeaveWindow>:		unhighlight()\n\
			<Btn1Down>,<Btn1Up>:	toggle() notify()";


/* 
 * First three toggles to tell what kind of contact 
 */

	ContactTranslations = XtParseTranslationTable(TransTable2);
	n = 0;
	XtSetArg(arg[n], XtNhorizDistance, 10); ++n;
	XtSetArg(arg[n], XtNfromVert, NULL); ++n;
	XtSetArg(arg[n], XtNleft, XtChainLeft); ++n;
	XtSetArg(arg[n], XtNright, XtChainLeft); ++n;
	XtSetArg(arg[n], XtNtop, XtChainTop); ++n;
	XtSetArg(arg[n], XtNbottom, XtChainTop); ++n;
	XtSetArg(arg[n], XtNtranslations, ContactTranslations); ++n;


	XtSetArg(arg[7], XtNfromHoriz, NULL);
	XtSetArg(arg[8], XtNradioData, contact[0]);
	Type_Phone = XtCreateManagedWidget("phone", toggleWidgetClass, 
					    Contacts, arg, 8); 

	XtSetArg(arg[7], XtNfromHoriz, Type_Phone);
	XtSetArg(arg[8], XtNradioData, contact[1]); 
	XtSetArg(arg[9], XtNradioGroup, Type_Phone); 
	Type_Mail = XtCreateManagedWidget("mail", toggleWidgetClass, 
				   Contacts, arg, 9);

	XtSetArg(arg[7], XtNfromHoriz, Type_Mail);
	XtSetArg(arg[8], XtNradioData, contact[2]); 
	XtSetArg(arg[9], XtNradioGroup, Type_Mail); 
	Type_Walkin = XtCreateManagedWidget("walkin", toggleWidgetClass, 
				   Contacts, arg, 9);

-PWM
------------------------------------------------------------------
Peter W. Morreale                  email:  morreale@ncar.ucar.edu
Nat'l Center for Atmos Research    voice:  (303) 497-1293
Scientific Computing Division     
Consulting Office
------------------------------------------------------------------

morreale@bierstadt.scd.ucar.edu (Peter Morreale) (05/04/91)

    I found my error.  I didn't enough of the "args[]" members to the 
    widgets.....

    Thanks anyway...

-PWM
------------------------------------------------------------------
Peter W. Morreale                  email:  morreale@ncar.ucar.edu
Nat'l Center for Atmos Research    voice:  (303) 497-1293
Scientific Computing Division     
Consulting Office
------------------------------------------------------------------