Contents

TwDefineEnumFromString (function)

TwType TwDefineEnumFromString(const char *name, const char *enumString)

Description

This function is an alternative to TwDefineEnum. It creates a new TwType corresponding to a C/C++ enum. Thus the type could be used with TwAddVar* functions to control variables of type enum.

Here the enum values are defined by a string containing a comma-separated list of labels. The first label is associated to 0, the second to 1, etc.

Parameters

name

Specify a name for the enum type (must be unique).

enumString

Comma-separated list of labels.

Return values

Example

int density;
TwType densityType;
 
// Defining new enum type
densityType = TwDefineEnumFromString("DensityType", "Low,Medium,High");
 
// Adding density to bar
TwAddVarRW(bar, "Density", densityType, &density, NULL);

See also

TwEnumVal, TwDefineEnum, TwAddVarRW, TwAddVarRO, TwAddVarCB, "enum" parameter syntax