Contents

TwSetParam (function)

int TwSetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues)

Description

This function modifies the value(s) of a bar or variable parameter. Parameters define the behavior of bars and vars and may be set by functions TwDefine or TwAddVar* using a definition string. TwSetParam is an alternative to these functions avoiding the conversion of the new parameter value into a definition string.

Parameters

bar

Bar identifier. If the parameter to modify is global, NULL may be used as identifier.

varName

If the parameter is directly related to a bar, varName should be NULL.

Otherwise, varName is the name of the parameter’s variable (ie., the unique name used to create the variable).

paramName

Name of the parameter. This is one of the key words listed in the bar parameters page if the parameter is directly related to a bar, or listed in the var parameters page if the parameter is related to a variable.

paramValueType

Type of the data pointed by inValues. Should be one of the constants defined by TwParamValueType: TW_PARAM_INT32, TW_PARAM_FLOAT, TW_PARAM_DOUBLE or TW_PARAM_CSTRING.

inValueCount

Depending on the parameter, one or more values may be required to modify it. For instance, a state parameter requires one value while a rgb-color parameter requires 3 values.

If the parameter value is a string, inValueCount must be 1 (not the length of the string), and the string must be an array of chars terminated by a zero (ie., a C-style string).

inValues

Pointer to the new parameter value(s). If there is more than one value, the values must be stored consecutively as an array starting at the address pointed by inValues.

Examples

// set a variable 'step' parameter
"varname", "step"// fold a group
"groupname", "opened"// set arrow color of a direction variable
"varname", "arrowcolor"// set a key shortcut
"ALT+a";
TwSetParam(bar, "varname", "keyincr"// set a bar values width
// pixels
"valueswidth"// set global icon alignment
"horizontal""iconalign"

Return value

See also

TwGetParam, TwDefine, bar parameters, var parameters