@s_bach I have an InExclude list, and some parameters that I set for each item. This is managed by a custom class ParameterArrayGroup
. I use a dummy attribute for each parameter, and from the object's GetDParameter
and SetDParameter
, I set the selected item's attribute in a custom data array.
This function detects if the selected items have different values, and set the control as a TriState. This is called from the objet's GetDParameter
. The selection vector contains the elements selected on the InExclude list.
void ParameterArrayGroup::GetDParameter( GeListNode* node, const DescID& id, GeData& t_data, DESCFLAGS_GET& flags, const std::vector<bool>& selection )
{
if ( parameters_.find( id[0].id ) == parameters_.end() )
return;
GeData firstValue;
auto selectedCount = 0u;
auto isTriState = false;
for( auto elementIndex = 0u ; elementIndex < selection.size() ; ++elementIndex )
{
if( selection[elementIndex] )
{
// This will read the specific item attribute from my custom data array
GetDParameter( node, id, t_data, flags, elementIndex );
if( selectedCount == 0 )
{
firstValue = t_data;
}
else if ( !isTriState )
{
isTriState = ( firstValue != t_data );
}
selectedCount++;
}
}
if( isTriState )
{
#if (API_VERSION >= 20000)
t_data.SetTristate();
#endif
}
}
The result is that when I have multiple items selected, my dummy attribute will display <<Multiple Values>>
. When I touch it, ParameterArrayGroup
takes care of writing the new value to the array, for each item. Then their value will be the same and TriState is not set anymore. This is working fine.
My question is only if I can set an attribute as TriState on R19.