2.3.1.76 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);
}
}
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_EX
Header to Include
GetNbox.h
Reference
|