xiaoding721
2023-11-13 e4edcfd0b987b239526f5375881b919789782dad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 );
  *]
}