Quintiq file version 2.0
#parent: #root
Method New (
  internal[GUIComponent] parent,
  Boolean showhideddloptimizer
) id:Method_DialogCreateEditOptimizerPuzzle_New
{
  #keys: '[146140.0.1633863947]'
  Body:
  [*
    // Create an OptimizerPuzzleWIP, this is a Work In Progress object that the 
    // user modify. This prevent modification on real OptimizerPuzzle, preventing useless
    // changes if the user start to modify OptimizerPuzzle and then cancel.
    // The OptimizerPuzzleWIP is the object that is displayed to the user. The real OptimizerPuzzle
    // is untouched and only changed if the user clicks OK
    
    // Hide ddl and button
    Dialog.ShowHideComponents( showhideddloptimizer );
    
    // Create an optimizerPuzzleWIP
    wip := OptimizerPuzzleWIP::Create( MacroPlan, false );
    
    Dialog.Data( wip );
    
    result := Dialog.DoModal( parent );
    
    if( result > 0 )
    {
      OptimizerPuzzle::Create( MacroPlan, 
                               Dialog.GetOptimizerPuzzleName(),
                               EditorDescription.Text(),
                               false, // IsLastUsed
                               false, // isFromDB
                               wip );
    }
  *]
}
