limj
2023-10-24 93652435728de839582440eefd5122c281181d35
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Quintiq file version 2.0
#parent: #root
Method EditScenario (
  Scenario selection,
  internal[GUIComponent] parent
) as Number id:Method_ScenarioManager_DialogCreateEditMPScenario_EditScenario
{
  #keys: '[11122.0.37341206]'
  Body:
  [*
    // Edit scenario
    
    this.Data( selection );
    this.GetKBStructure();
    this.SetAdvanced();
    
    Dialog.EditorScenarioName().Text( selection.Name() );
    
    LabelAssumption.Visible( false );
    EditorAssumption.Visible( false );
    
    result := this.DoModal( parent );
    
    if ( result > 0 )
    {
      scenario:= selection.Update( EditorScenarioName.Text(), EditorComment.Text(), RadioButtonGroupStorageState.BoundValue() );
      
      if ( not isnull( SelectionStrategy.Data() ) )
      {
        scenario.SelectedStrategy( relset, SelectionStrategy.Data() );
      }  
      
      if ( RadioButtonGroupMode.BoundValue() = GlobalParameters_MP::GetKB_New() )
      {
        this.InstantiateAndSelectKB( selection );
      }
      else if ( RadioButtonGroupMode.BoundValue() = GlobalParameters_MP::GetKB_CreateCopy() )
      {
        this.CopyAndSelectKB( SelectionKBBranch.Data(), selection );
      }
      
      else
      {
        ApplicationLibMacroPlanner.SelectKB( selection, SelectionKBBranch.Data() );
      }
    }
    return result;
  *]
}