2.3.1.19 GETN_COMBO


Name

GETN_COMBO

Declaration

#define GETN_COMBO(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL, _COMBO_STR) _tmpSubNode = _tmpNode.AddNumericNode((double)_DEFAULT_VAL, #_NODE_NAME, TRGP_NUMERIC_LIST); TREE_ADD_LABEL(_NODE_LABEL);_tmpSubNode.SetAttribute(STR_COMBO_ATTRIB, _COMBO_STR);

Remark

This macro creates a combo control containing numeric values in the GetN_Box dialogbox.

Parameters

_NODE_NAME
[input] the name of the new node to be added to the tree
_NODE_LABEL
[input] the string value to show the combo name in the dialogbox
_DEFAULT_VAL
[input] double contents as the default value to show in the combo box
_COMBO_STR
[input] string type, should be a numeric values list separated with "|". For example, "2|3|4|5|6". Add "|" at the beginning, combo control will be editable.

Return

Examples

EX1

This example shows the difference in GETN_COMBO, GETN_LIST and GETN_STRLIST
#include <GetNBox.h>
void GETN_COMBO_ex1()
{
    GETN_BOX( treeTest );
    GETN_COMBO(order, "Polynomial Order", 2, "2|3|4|5|6") // dropdown list, only allow to choose one from list
    GETN_LIST(Type, "Analysis Type", 1, "t-Test|Correlation|NLSF|Polynomial Fit|Statistics")
    GETN_STRLIST(WksName, "Worksheet Name", "one", "|one|two|three|four|five") // editable, choose one from list or directly type string into control
 
    if( GetNBox( treeTest, _event_func_ex )) // to open getn dialog
        out_tree( treeTest );
}


int _event_func_ex(TreeNode& tr, int nRow, int nEvent, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& getNContainer, string& strAux, string& strErrMsg)
{
	 TreeNode trEdited; 
 
    // check nEvent
    switch(nEvent)
    {
    case GETNE_ON_INIT:
    	out_str("Dialog Init event.");
    	break;
 
    case GETNE_ON_OK:
    	out_str("Cliked OK button. ");
    	break; 
 
    case GETNE_ON_VALUE_CHANGE:    
    	trEdited = tree_get_node(tr, nRow);
    	if( trEdited )
    	    	printf("%s control changed.\n", trEdited.tagName);
    	break;
    }
 
    // use lpcszNodeName to get the changed node
    if(lstrcmpi(lpcszNodeName,"WksName") == 0)
    {
    	out_str(tr.WksName.strVal);
    }
    
	return true;
}

See Also

GETN_LIST, GETN_STRLIST

Header to Include

GetNbox.h

Reference