Quintiq file version 2.0
#parent: #root
Method UpdateCheckboxState () id:Method_DialogCreateEditTransitionType_UpdateCheckboxState
{
  #keys: '[146302.1.801624150]'
  Body:
  [*
    //by checking quantiti it will default to duration if nothing is found
    quantitybased := RadioButtonGroupQuantityDuration.BoundValue() = GlobalParameters_MP::GetCampaignTransitionsTypeQuantity();
    durationbased := not quantitybased;
    durZero := Duration::Zero()
    data := this.Data();
    
    //show/hide durations
    GUIDurationSelectorMinDuration.Visible( durationbased );
    GUIDurationSelectorMaxDuration.Visible( durationbased );
    
    LabelMinDuration.Visible(durationbased );
    LabelMaxDuration.Visible( durationbased );
    CheckBoxDefaultMaxDuration.Visible( durationbased );
    
    // Reset duration selector value when switching radio button
    GUIDurationSelectorMinDuration.Duration( ifexpr( durationbased, data.DefaultMinDuration(), durZero ) );
    GUIDurationSelectorMaxDuration.Duration( ifexpr( durationbased, data.DefaultMaxDuration(), durZero ) ); 
    
    //show/hide quantity
    EditorDefaultMinQuantity.Visible( quantitybased );
    EditorDefaultMaxQuantity.Visible( quantitybased );
    LabelMinQuantity.Visible( quantitybased );
    LabelMaxQuantity.Visible( quantitybased );
    CheckBoxDefaultMaxQuantity.Visible( quantitybased );
    
    //Enable/disable
    EditorDefaultMaxQuantity.Enabled( CheckBoxDefaultMaxQuantity.Checked() );
    GUIDurationSelectorMaxDuration.Enabled( CheckBoxDefaultMaxDuration.Checked() );
  *]
}
