GETN_COLORLIST


Name

GETN_COLORLIST

Declaration

#define GETN_COLORLIST(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL) _tmpSubNode = _tmpNode.AddNode(#_NODE_NAME,ONODETYPE_DROPLIST_COLORS);TREE_ADD_LABEL(_NODE_LABEL); _tmpSubNode.SetAttribute(STR_RESID_ATTRIB,COLORLIST_INCREMENT_LIST | COLORLIST_PAL_FILE_FOR_INCREMENT_LIST); _tmpSubNode.SetAttribute(STR_OCNTRL_OPTNS, OCNTRLPARAM1_STRECTH_COLOR_RECT);_tmpSubNode.nVals=_DEFAULT_VAL;

Remark

This macro creates a color list dropdown in the 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 as the node name in the dialogbox
_DEFAULT_VAL
[input] array of color index

Return

Examples

EX1

void GETN_COLOR_CHOICE_OPTIONS_ex2()
{
	GETN_TREE(tr)
		
	GETN_STR(info, " ", "Please pick a color") GETN_READ_ONLY
    GETN_COLOR(LineColor, "Fit Curve color", 3)
    
	GETN_COLOR(clr, "Color", 0)	GETN_COLOR_CHOICE_OPTIONS(COLORLIST_CUSTOM )
	
	vector<int>		vnClrs = {1, 14, 6, 16842624, 2, 4, 33521664, 3};
	GETN_COLORLIST(ColorList,"color list",vnClrs)
	
    if( GetNBox( tr ))
    {
        char szTemp[100];
        int nIndex = tr.LineColor.nVal;
        color_index_to_name(nIndex, szTemp, 100);
        UINT cr = color_index_to_rgb(nIndex);
        printf("choosen color %s\n", szTemp);
        printf("Red = %d, Green = %d, Blue = %d\n", GetRValue(cr), GetGValue(cr), GetBValue(cr));
    }
}

See Also

GETN_COLOR

header to Include

GetNbox.h

Reference