Quintiq file version 2.0
#parent: CustomDrawComponentProgress/CDDL
Response OnDrawObject (
  shadow[LibOpt_UIOwner] object
) id:Response_CustomDrawComponentProgress_CDDL_OnDrawObject
{
  #keys: '[139544.2.1955658780]'
  Body:
  [*
    percentage := average( DataHolderPromises.Data(), Elements, promise, true, promise.StepsFinished() / promise.Steps() );
    
    bar := Shape::Rect( 0, 0, [Number] ( percentage * 100 ), 10 );
    surface.Fill( bar, Color::Orange() );
    
    message := '';
    if( exists( DataHolderPromises.Data(), Elements, promise, promise.ErrorMessage().Length() > 0 ) )
    {
      message := Translations::LibOpt_BT_Promise_ErrorHasOccured();
    }
    else if( DataHolderPromises.Data().Size() = 1 )
    {
      message := DataHolderPromises.Data().First().Description()
    }
    else
    {
      message := Translations::LibOpt_BT_Progress_Multiple( DataHolderPromises.Data().Size() );
    }
    
    
    format := TextFormat::Construct( TextFormat::NoEllipses(), TextFormat::AlignMiddle() );
    surface.Text( 3, 0, 97, 10, message, format );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject'
}
