Quintiq file version 2.0
#parent: #root
Method EditSalesSegment (
  internal[GUIComponent] parent,
  SalesSegment_MP selection
) as Number id:Method_DialogCreateEditSalesSegment_EditSalesSegment
{
  #keys: '[107654.0.932618380]'
  Body:
  [*
    // Edit sales segment
    this.Data( selection );
    DataHolderParentSalesSegment.Data( selection.Parent() );
    CheckBoxParentSalesSegment.Checked( not isnull( selection.Parent() ) );
    Dialog.EnableDisableComponents();
    
    result := this.DoModal( parent );
    if ( result > 0 )
    {
      displayindex := ApplicationLibMacroPlanner.FormatStringToNumber( EditorIndex.Text(), 0 );
      parentSalesSegment := null( SalesSegment_MP );
      if( CheckBoxParentSalesSegment.Checked() )
      {
        parentSalesSegment := SelectionParentSalesSegment.Data();
      }
      Dialog.Data().Update( EditorName.Text(), parentSalesSegment, displayindex, false );
    }
    return result;
  *]
}
