2.3.1.50 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;
}

//show the difference in GETN_STR_GROUP, GETN_MULTISEL_STR_LISTBOX and GETN_MULTISEL_LISTBOX
void tms()
{
	vector<string> vsFruits = {"Apple", "Orange", "Banana", "Berries", "Grapes"};
	string strCombo;
	strCombo.SetTokens(vsFruits, '|');
	
	GETN_TREE(tr)
	GETN_STR_GROUP(stats, "Please pick a few US Stats", "MA", "|MA|CA|RI|VT|NY")
	GETN_MULTISEL_STR_LISTBOX(StateList, _L("Positive State Value"), "", "a|b|c")
	GETN_MULTISEL_LISTBOX(list, "Select", 0, strCombo)
	
	if(GetNBox(tr, Dialog1Node_event , "Dialog title"))
	{
		out_tree( tr );
		
		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);
		}	
	}
}

EX2

Show a column list
#include <..\OriginLab\wks_utils.h>
void collist_ex()
{	
	GETN_TREE(tr)
	GETN_MULTISEL_LISTBOX(colList, "Select", 0, "")
	
	FUNC_INIT_GETN_COL_LIST_CTRLS pfn = Project.FindFunction("init_GetN_col_list_ctrls", "OriginLab\\wks_utils", TRUE);
	if( pfn )	
		pfn(NULL, tr.colList);
	
	GetNBox(tr);
}

See Also

GETN_LISTBOX
GETN_STR_GROUP
GETN_MULTISEL_STR_LISTBOX

Header to Include

GetNBox.h

Reference