Parent document is top of "Motif FAQ (Part 6 of 9)"
Previous document is "175) Can I change or disable the menu bar accelerator from the"
Next document is "177) How can I determine the item selected in a a radio box or"

176) How do I set the current choice in a radio box or an option

menu?

[Last modified: May 95]

Answer:  Set the XmNmenuHistory resource on its RowColumn parent.

Ken Lee, http://www.rahul.net/kenton/

buser@tartan.com (Mark) sent this code fragment:

    Widget      menu;
    int         num_buttons;
    WidgetList  buttons;

    XtVaGetValues( simple_option_widget, XmNsubMenuId, &menu, NULL);

    XtVaGetValues( menu, XmNnumChildren, &num_buttons,
                XmNchildren, &buttons, NULL ) ;

 and change current selection with:

    XtVaSetValues( simple_option_widget, XmNmenuHistory, buttons[index], NULL ) ;

    /* where index is between 0 and num_buttons */

Thanks to Phil Gehlich <pgehlich@hp7001.ecae.StorTek.COM> for a correction.

Parent document is top of "Motif FAQ (Part 6 of 9)"
Previous document is "175) Can I change or disable the menu bar accelerator from the"
Next document is "177) How can I determine the item selected in a a radio box or"