2.3.1.46 GETN_MULTISEL_LISTBOX


Name

GETN_MULTISEL_LISTBOX

Declaration

#define GETN_MULTISEL_LISTBOX(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL, _COMBO_STR)  _tmpSubNode = _tmpNode.AddNode(#_NODE_NAME, ONODETYPE_MULTISEL_LISTBOX); _tmpSubNode.nVals = (int)_DEFAULT_VAL;TREE_ADD_LABEL(_NODE_LABEL);_tmpSubNode.SetAttribute(STR_COMBO_ATTRIB, _COMBO_STR);

Remark

This macro allow user to select multiple items from the listbox

Parameters

_NODE_NAME
[input] The node name of the control
_NODE_LABEL
[input] Label of the control
_DEFAULT_VAL
[input] The index of the default value in _COMBO_STR
_COMBO_STR
[input] Values that allow user to select from

Return

Examples

EX1

static int Dialog1Node_event(TreeNode& tr, int nRow, int nEvent, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& getNContainer, string& strAux, string& strErrMsg)
{	
	string strNode = lpcszNodeName;
	
	if(strNode == "list") {
		vector<int> vnSel;
		vnSel = tr.list.nVals;
		for(int ii = 0; ii < vnSel.GetSize(); ii++) {
			printf("%d: %d\n", ii+1, vnSel[ii]);
		}
	}

	return true;
}

void tms()
{
	vector<string> vsFruits = {"Apple", "Orange", "Banana", "Berries", "Grapes"};
	string strCombo;
	strCombo.SetTokens(vsFruits, '|');
	
	GETN_TREE(tr)
	GETN_MULTISEL_LISTBOX(list, "Select", 0, strCombo)
	
	if(GetNBox(tr, Dialog1Node_event , "Dialog title"))
	{
		vector<int> vnSel;vnSel = tr.list.nVals;
		for(int ii = 0; ii < vnSel.GetSize(); ii++) {			
			string strName = vsFruits[vnSel[ii]];
			printf("%d: %s\n", ii+1, strName);
		}	
	}
}

See Also

GETN_LISTBOX

Header to Include

GetNBox.h

Reference