GETN_LISTBOX

 

Name

GETN_LISTBOX

Declaration

#define GETN_LISTBOX(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL, _COMBO_STR)  _tmpSubNode = _tmpNode.AddNumericNode((int)_DEFAULT_VAL, #_NODE_NAME, ONODETYPE_LISTBOX); TREE_ADD_LABEL(_NODE_LABEL);_tmpSubNode.SetAttribute(STR_COMBO_ATTRIB, _COMBO_STR);

Remark

This macro creates a list box in the dialogbox.

Use numeric offset to set the default showing string.

Parameters

_NODE_NAME
[input] the name of the new node to be added to the tree
_NODE_LABEL
[input] the string value to show as the node name in the dialogbox
_DEFAULT_VAL
[input] numeric offset
_COMBO_STR
[input] the combo list, "|one|two|three|four|five" will show a list of one, two, three, four , five

Return

Examples

EX1

#include <GetNBox.h>

static int _event_func_ex(TreeNode& tr, int nRow, int nEvent, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& getNContainer, string& strAux, string& strErrMsg)
{
    if(lstrcmpi(lpcszNodeName,"Type") == 0)
    {
        string strCombo;
        tr.Type.GetAttribute(STR_COMBO_ATTRIB, strCombo);
                out_str( strCombo.GetToken(tr.Type.nVal, '|') );
    }

    return true;
}

void GETN_LISTBOX_ex1()
{
    GETN_BOX( treeTest );
    GETN_LISTBOX(Type, "Analysis Type", 1, "t-Test|Correlation|NLSF|Polynomial Fit|Statistics")
    if( GetNBox( treeTest, _event_func_ex ))
        out_tree( treeTest );
}

EX2

Following code show how to add scrollbar to list box when the list box becomes too long. It works for GETN_MULTISEL_STR_LISTBOX and GETN_MULTISEL_LISTBOX as well.
#include <GetNbox.h>

void STR_MAX_SHOWN_ITEM_COUNT_ATTRIB_ex()
{
    GETN_BOX( treeTest );
    
    //each list box has 5 items 
    GETN_LISTBOX(LType, "GETN_LISTBOX", 1, "t-Test|Correlation|NLSF|Polynomial Fit|Statistics")
        
    //only show 3 items
    treeTest.LType.SetAttribute(STR_MAX_SHOWN_ITEM_COUNT_ATTRIB, 3);
    
    if( GetNBox( treeTest ))
        out_tree( treeTest );
}

See Also

GETN_MULTISEL_LISTBOX, GETN_MULTISEL_STR_LISTBOX

header to Include

GetNbox.h

Reference