Quintiq file version 2.0
#parent: CustomDrawComponent
Response OnClick (
  structured[UnitNode] selection
) id:Response_CustomDrawComponent_MenuNewRouting_OnClick
{
  #keys: '[124808.0.1318459564]'
  Body:
  [*
    // Create a new routing, routing step, and an operation from data holder highlight
    units := selectset( DataHolderHighlight.Data(), Elements.astype( UnitNode ).Unit, unit, true );
    
    routings := Routing::CreateFromUnits( units );
    
    if( routings.Size() > 0 )
    {
      form := Application.Frame().FindChildObject( 'FormRoutings' ).astype( FormRoutings );
      if( not isnull( form ) )
      {
        ApplicationLibMacroPlanner.AutoSelectElementsInList( form.ListRouting(), routings );
      }
    }
  *]
  CanBindMultiple: false
  DefinitionID => /CustomDrawComponent/Responsedef_CustomDrawComponent_Menu_OnClick
  Initiator: 'MenuNewRouting'
  Precondition:
  [*
    return Operation::CanCreate( feedback, selection, MacroPlan );
  *]
}
