Quintiq file version 2.0
#parent: #root
Method DisablePattern (
  String feedback_i
) id:Method_LibCal_dlgEvent_DisablePattern
{
  #keys: '[131094.0.1371933942]'
  Body:
  [*
    // Disable the controls of the recurrence pattern.
    // The individual controls are disabled in order to be able to give feedback on the controls themselves instead of
    // on the panel, and in order to be able to also change the colors of the lines.
    
    // Toggle-buttons, if applicable
    isInitiator := this.Data().Calendar() = dhLeadingParticipation.Data().Calendar();
    if( not isInitiator )
    {
      btnNoRecurrence.DisableWithUserFeedback( feedback_i );
      btnWeekly      .DisableWithUserFeedback( feedback_i );
      btnMonthly     .DisableWithUserFeedback( feedback_i );
      btnYearly      .DisableWithUserFeedback( feedback_i );
    }
    
    // Separator
    lblRecurrencePattern.TextColor( Color::Gray() );
    lblHorizontalLine2  .TextColor( Color::LightGray() );
    
    // Daily
    if( btnDaily.Pressed() )
    {
      ckbEvery       .DisableWithUserFeedback( feedback_i );
      ckbEveryWeekday.DisableWithUserFeedback( feedback_i );
    
      edtEveryNrOfDays.TextColor( Color::LightGray() );  // Does not work.
      edtEveryNrOfDays.DisableWithUserFeedback( feedback_i );
      lblDays         .TextColor( Color::Gray() );
    }
    
    // Weekly
    else if( btnWeekly.Pressed() )
    {
      lblRecurWeekly   .TextColor( Color::Gray() );    
      edtEveryNrOfWeeks.TextColor( Color::LightGray() );  // Does not work.
      edtEveryNrOfWeeks.DisableWithUserFeedback( feedback_i );
      lblWeeks         .TextColor( Color::Gray() );
    
      lblOn       .TextColor( Color::Gray() );
      btnMonday   .DisableWithUserFeedback( feedback_i );
      btnTuesday  .DisableWithUserFeedback( feedback_i );
      btnWednesday.DisableWithUserFeedback( feedback_i );
      btnThursday .DisableWithUserFeedback( feedback_i );
      btnFriday   .DisableWithUserFeedback( feedback_i );
      btnSaturday .DisableWithUserFeedback( feedback_i );
      btnSunday   .DisableWithUserFeedback( feedback_i );
    }
    
    // Monthly
    else if( btnMonthly.Pressed() )
    { 
      // Specific day
      ckbMonthlyDay               .DisableWithUserFeedback( feedback_i );
      edtMonthlyDay               .TextColor( Color::LightGray() );  // Does not work.
      edtMonthlyDay               .DisableWithUserFeedback( feedback_i );
      lblMonthlyDayOfEvery        .TextColor( Color::Gray() );
      edtMonthlyDayEveryNrOfMonths.TextColor( Color::LightGray() );  // Does not work.
      edtMonthlyDayEveryNrOfMonths.DisableWithUserFeedback( feedback_i );
      lblMonthlyDayMonths         .TextColor( Color::Gray() );
    
      // Pattern
      ckbMonthlyPattern               .DisableWithUserFeedback( feedback_i );
      ssMonthlyPatternWeekOfMonth     .DisableWithUserFeedback( feedback_i );
      ssMonthlyPatternWeekOfMonth     .TextColor( Color::Gray() );
      ssMonthlyPatternDayOfWeek       .DisableWithUserFeedback( feedback_i );
      ssMonthlyPatternDayOfWeek       .TextColor( Color::Gray() );
      lblMonthlyPatternOfEvery        .TextColor( Color::Gray() );
      edtMonthlyPatternEveryNrOfMonths.TextColor( Color::LightGray() );  // Does not work.
      edtMonthlyPatternEveryNrOfMonths.DisableWithUserFeedback( feedback_i );
      lblMonthlyPatternMonths         .TextColor( Color::Gray() );  
    }
    
    // Yearly
    else if( btnYearly.Pressed() )
    {
      lblRecurYearly   .TextColor( Color::Gray() );    
      edtEveryNrOfYears.TextColor( Color::LightGray() );  // Does not work.
      edtEveryNrOfYears.DisableWithUserFeedback( feedback_i );
      lblYears         .TextColor( Color::Gray() );
      
      // Specific date
      ckbYearlyDay     .DisableWithUserFeedback( feedback_i ); 
      ssYearlyMonth     .DisableWithUserFeedback( feedback_i );
      ssYearlyMonth     .TextColor( Color::Gray() );
      ssYearlyDayOfMonth.DisableWithUserFeedback( feedback_i );
      ssYearlyDayOfMonth.TextColor( Color::Gray() );
      
      // Pattern
      ckbYearlyPattern          .DisableWithUserFeedback( feedback_i );
      ssYearlyPatternWeekOfMonth.DisableWithUserFeedback( feedback_i );
      ssYearlyPatternWeekOfMonth.TextColor( Color::Gray() );
      ssYearlyPatternDayOfWeek  .DisableWithUserFeedback( feedback_i );
      ssYearlyPatternDayOfWeek  .TextColor( Color::Gray() );
      lblYearlyPatternOf        .TextColor( Color::Gray() );
      ssYearlyPatternMonth      .DisableWithUserFeedback( feedback_i );
      ssYearlyPatternMonth      .TextColor( Color::Gray() );
    }
  *]
}
