2.3.1.77 GETN_RADIO_INDEX_EX


Name

GETN_RADIO_INDEX_EX

Declaration

#define GETN_RADIO_INDEX_EX(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL, _COMBO_STR)		GETN_RADIO_INDEX(_NODE_NAME, _DEFAULT_VAL, _COMBO_STR)		TREE_ADD_LABEL(_NODE_LABEL);

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
_NODE_LABEL
[input] the label of control
_DEFAULT_VAL
[input] the default choice
_COMBO_STR
[input] the string 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_EX_ex1()
{
    GETN_BOX(trInfo)
    GETN_CHECK(citizen, "US Citizen", 0)    
    GETN_RADIO_INDEX_EX(genderChoice, "Gender", 0, "Male|Female|Other")
            GETN_OPTION_DISPLAY_FORMAT(DISPLAY_EDITOR_LEFT)
    

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

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

EX2

this example show the difference between GETN_RADIO_INDEX and GETN_RADIO_INDEX_EX
void GETN_RADIO_INDEX_ex2()
{
    GETN_BOX(trInfo)
    
    GETN_BEGIN_BRANCH(gender, "Gender")
        GETN_RADIO_INDEX(genderChoice, 0, "Male|Female|Other")// choice "Other" to show another group of radios
    GETN_END_BRANCH(gender)
    
    GETN_RADIO_INDEX_EX(genderChoice2, "Gender2", 0, "I|II|III")
            //GETN_OPTION_DISPLAY_FORMAT(DISPLAY_EDITOR_LEFT) //this option will hide the label
    
    if( GetNBox(trInfo, _radio_event_func_ex) )
    {
        out_tree(trInfo);
    }
}

static int _radio_event_func_ex(TreeNode& tr, int nRow, int nEvent, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& getNContainer, string& strAux, string& strErrMsg)
{   
    tr.genderChoice2.Show = tr.gender.genderChoice.nVal > 1;
    
    return 0;
}

See Also

GETN_RADIO_INDEX

Header to Include

GetNbox.h

Reference