|
Contents
TwSetParam (function)
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. Parametersbar
Bar identifier. If the parameter to modify is global, varName
If the parameter is directly related to a bar,
Otherwise, paramNameName 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: inValueCountDepending 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, 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 Examples// set a variable 'step' parameter float vstep = 0.1f; TwSetParam(bar, "varname", "step", TW_PARAM_FLOAT, 1, &vstep); // fold a group int opened = 0; TwSetParam(bar, "groupname", "opened", TW_PARAM_INT32, 1, &opened); // set arrow color of a direction variable int color[3] = { 255, 255, 128 }; TwSetParam(bar, "varname", "arrowcolor", TW_PARAM_INT32, 3, color); // set a key shortcut char keysc[] = "ALT+a"; TwSetParam(bar, "varname", "keyincr", TW_PARAM_CSTRING, 1, keysc); // set a bar values width int width = 160; // pixels TwSetParam(bar, NULL, "valueswidth", TW_PARAM_INT32, 1, &width); // set global icon alignment char align[] = "horizontal"; TwSetParam(NULL, NULL, "iconalign", TW_PARAM_CSTRING, 1, align); Return value
See also |