yanweiyuan3
2023-08-09 fd693f0faf305ec98d7ea03e09fe6787817e71d7
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
Quintiq file version 2.0
#parent: #root
Method OnChangedRadioButton () id:Method_DialogCreateEditCampaign_OnChangedRadioButton
{
  #keys: '[150660.2.946354305]'
  Body:
  [*
    // Handle default dialog values when change of radio button selection
    checkedRadioButton := RadioButtonGroupQuantityDuration.BoundValue().TrimBoth();
    data := DataHolderDialogData.Data();
    if( not isnull( data ) )
    {
      quantitybased := checkedRadioButton = GlobalParameters_MP::GetCampaignTransitionsTypeQuantity();
      durationbased := not quantitybased;
    
      // On changed radio button selection will reset min/max qty/duration to default values
      if( checkedRadioButton <> data.InputType() )
      {
        EditorCampaignMinQuantity.Text( ifexpr( quantitybased, ApplicationMacroPlanner.FormatRealToString( data.MinQuantity() ), '0' ) );
        DurationSelectorMinDuration.Duration( ifexpr( durationbased, data.MinDuration(), Duration::Zero() ) );
        Form.EnableDisableMaxQuantity( quantitybased and data.HasInputMaxQuantity() );
        Form.EnableDisableMaxDuration( durationbased and data.HasInputMaxDuration() );
        // Set input type ( workaround: retain earliest start before changing input type )
        data.EarliestStart( dsEarliestStart.DateTime() );
        data.InputType( checkedRadioButton );
        
      }
    }
  *]
}