2.3.1.68 GETN_RADIO_INDEX


Name

GETN_RADIO_INDEX

Declaration

#define GETN_RADIO_INDEX(_NODE_NAME, _DEFAULT_VAL, _COMBO_STR)  _tmpSubNode = _tmpNode.AddNumericNode((int)_DEFAULT_VAL, #_NODE_NAME, ONODETYPE_RADIOS_BY_INDEX); _tmpSubNode.SetAttribute(STR_COMBO_ATTRIB, _COMBO_STR);

Remark

Creates a group of radios.

The labels are obtained from _COMBO_STR. The values of a node are numeric, reprsenting zero-offset index of the selected radio.

Parameters

_NODE_NAME
[input] the name of the new node to be added to the tree
_DEFAULT_VAL
[input] numeric offset
_COMBO_STR
[input] the combo list, "one|two|three|four|five" will show a list of radio buttons with text one, two, three, four, five.

Return

Examples

EX1

#include <GetNBox.h>
void GETN_RADIO_INDEX_ex1()
{
    GETN_BOX(trInfo)
    GETN_CHECK(citizen, "US Citizen", 0)
    GETN_BEGIN_BRANCH(gender, "Gender")
        GETN_RADIO_INDEX(genderChoice, 0, "Male|Female|Other")
            GETN_OPTION_DISPLAY_FORMAT(DISPLAY_EDITOR_LEFT)
    GETN_END_BRANCH(gender)

    if( GetNBox(trInfo, "Your Info") )
    {
        out_tree(trInfo);

        int citizen = trInfo.citizen.nVal;
        int gender = trInfo.gender.genderChoice.nVal;
        printf("Citizen: %d\nGender: %d\n", citizen, gender);
    }
}

See Also

GETN_RADIO_INDEX_EX

Header to Include

GetNbox.h

Reference