2.3.1.16 GETN_COLOR


Name

GETN_COLOR

Declaration

#define GETN_COLOR(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL) _tmpSubNode = _tmpNode.AddNumericNode(_DEFAULT_VAL, #_NODE_NAME, TRGP_COLOR);TREE_ADD_LABEL(_NODE_LABEL);

Remark

This macro creates a color combo list(system palette) in the dialogbox.

Use numeric offset to set the default color by index.

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] index of the color

Return

Examples

EX1

#include <GetNbox.h>
void GETN_COLOR_ex1()
{
    GETN_TREE(tr);
    GETN_STR(info, " ", "Please pick a color") GETN_READ_ONLY
    GETN_COLOR(LineColor, "Fit Curve color", 3)
    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_CHOICE_OPTIONS

Header to Include

GetNbox.h

Reference