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; 
 | 
  *] 
 | 
} 
 |