This is a migrated thread and some comments may be shown as answers.

Larger spaces between labels in Recurrences DialogBox

5 Answers 195 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
slear
Top achievements
Rank 1
slear asked on 18 Apr 2010, 12:35 AM
Hello to you all,
I'm translating the resource strings in Scheduler. I have a problem with the Recurrence DialogBox.
The italian text is simple too long to write in the narrow space provided for the various labels.
Is it possible to wide the distance between labels?
(See the attached image)

5 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 22 Apr 2010, 12:52 PM
Hello slear,

You can do the following:

1. Inherit the EditAppointmentDialog class
2. Override the CreateRecurrenceDialog method
3. In the overridden method you can set your own customized EditRecurrenceDialog or modify some of the fields of the existing one. The code snippet below shows how you can change the Width property of some of the controls in the dialog:

private class EditAppointmentDialogEx : EditAppointmentDialog
      {
          protected override IEditRecurrenceDialog CreateRecurrenceDialog(IEvent recurringAppointment)
          {
              EditRecurrenceDialog dialog = (EditRecurrenceDialog)base.CreateRecurrenceDialog(recurringAppointment);
               
              foreach (Control control in dialog.Controls)
              {
                  if (control as GroupBox != null)
                  {
                      foreach (Control childControl in control.Controls)
                      {
                          if (childControl.Name.Equals("radioNoEndDate"))
                          {
                              childControl.MinimumSize = new Size(500, childControl.Height);
                            }
                          else if (childControl.Name.Equals("radioEndAfter"))
                          {
                              childControl.MinimumSize = new Size(500, childControl.Height);
                          }
                          else if (childControl.Name.Equals("radioEndBy"))
                          {
                              childControl.MinimumSize = new Size(500, childControl.Height);
                          }
                      }
                  }
              }
              return dialog;
          }
      }

4. Subscribe to the AppointmentEditDialogShowing event of RadScheduler
5. In the event handler, set the new EditAppointmentDialog to the AppointmentEditDialog property.

void radScheduler_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
     {       
         e.AppointmentEditDialog = new EditAppointmentDialogEx();
      }

I hope this helps.

Sincerely yours,
Boyko Markov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tartaruga
Top achievements
Rank 1
answered on 13 Nov 2010, 03:27 PM
Hello to all,

I'm French, so if there are some mistakes in my sentences, don't care !
I'm also translating the resources in the Recurrence Dialog Box, I have applicated the code in order to change the width property of the controls in the dialog.
But I can't change the width of the controls of the DailyRecurrenceSettings, WeeklyRecurrenceSettings, etc...

Here is a part of my code in my customized appointment :

Protected Overrides Function CreateRecurrenceDialog(ByVal recurringAppointment As IEvent) As IEditRecurrenceDialog
        Dim dialog As EditRecurrenceDialog = DirectCast(MyBase.CreateRecurrenceDialog(recurringAppointment),  EditRecurrenceDialog)

        For Each control As Control In dialog.Controls
            If TryCast(control, GroupBox) IsNot Nothing Then
                For Each childControl As Control In control.Controls
                    If childControl.Name.Equals("radioDaily") Or childControl.Name.Equals("radioWeekly") Or childControl.Name.Equals("radioMonthly") Or childControl.Name.Equals("radioYearly") Then
                        childControl.Width = 65
                    End If
                Next
            End If
          Next

        Return dialog
End Function


So, how could I change the width of the controls : radioButtonEveryday, radioButtonEveryWeekday, etc... (see attached file "recurrence")
And how could I change the position of these controls? I'd like to change the order of the day in the WeeklyRecurrenceSettings (see the attached file "recurrence2")  : "Dimanche" (= Sunday) would be fine after "Samedi" (= Saturday)


Thank you for your help
0
Dobry Zranchev
Telerik team
answered on 18 Nov 2010, 02:39 PM
Hello Tartaruga,

Thank you for writing.

The best solution to change the width and position of the controls is to inherit the EditRecurrenceDialog and do the following steps:
1. In order to change the size of the weekly recurrence rule settings, you should create a class that inherits from the WeeklyRecurrenceSettings. Reorder or re-size its controls as you find appropriate.
2. Override the method CreateRadioToSettingsDictionary of the EditRecurrenceDialog. In this method you should add the extended WeeklyRecurrenceSettings in the collection instead of the standard one.
Protected Overridable Sub CreateRadioToSettingsDictionary()
    Me.radioToSettingsDictionary = New Dictionary(Of RadRadioButton, IRecurrenceRuleSettingsControl)()
 
    Me.radioToSettingsDictionary.Add(Me.radioDaily, New DailyRecurrenceSettings())
    Me.radioToSettingsDictionary.Add(Me.radioWeekly, New WeeklyRecurrenceSettings())'Add your custom WeeklyRecurrenceSettings here
    Me.radioToSettingsDictionary.Add(Me.radioMonthly, New MonthlyRecurrenceSettings())
    Me.radioToSettingsDictionary.Add(Me.radioYearly, New YearlyRecurrenceSettings())
End Sub
3. Subscribe to the RecurrenceEditDialogShowing event of the RadScheduler and set your custom EditRecurrenceDialog to the event arguments.

If you have other questions, feel free to write back.

Sincerely yours,
Dobry Zranchev
the Telerik team
See What's New in RadControls for WinForms in Q3 2010 on Wednesday, November 17, 11am Eastern Time: Register here>>
0
Tartaruga
Top achievements
Rank 1
answered on 12 Dec 2010, 05:01 PM
Hello Dobry Zranchev,

Thanks for your answer.I didn't have the time to work on my project, but I'm trying now !

I created a class "custom_weeklyRecurrenceSettings" with a sub Main in order to resize or reorder the controls like "radioWeekly" or "chkSunday"
I overrided the method CreateToSettingsDictionnary in my class "evenement_recurrent" (inherits from the EditRecurrenceDialog)
I subscribed to the RecurrenceEditDialogShowing event of the RadScheduler and set your custom EditRecurrenceDialog to the event arguments.

But I have some problems to add my "custom_weeklyRecurrenceSettings" in the overrided "CreateToSettingsDictionnary".
How can I do it?
Could you just give me an example to change the name of the radioButton "chkSunday" and its position in the form?
And how can I code "custom_weeklyRecurrenceSettings.chkSunday.left = WeeklyRecurrenceSettings.chkSaturday.left" ? (do you understand my question??)

Thank you for your help
0
Dobry Zranchev
Telerik team
answered on 16 Dec 2010, 04:34 PM
Hello Tartaruga,

Thank you for writing.

I understand your question, but as I already wrote in my previous post, you have to create a custom UserControl descending from WeeklyRecurrenceSettings. After doing so, you will be able to modify any of its controls (re-arrange, re-size, etc.). Look at the code snippet provided bellow. It demonstrates how to override WeeklyRecurrenceSettings control and EditRecurrenceDialog and how use the overridden control in this dialog.
'This is the custom user control that inherits WeeklyRecurrenceSettings.
Public Class UserControl3
    Inherits WeeklyRecurrenceSettings
    Public Sub New()
        InitializeComponent()
    End Sub
End Class
 
'overridden EditRecurrenceDialog
Public Class recurrenceDlg
    Inherits EditRecurrenceDialog
    Public Sub New(appointment As IEvent)
        MyBase.New(appointment, Nothing)
    End Sub
 
    Public Sub New(appointment As IEvent, schedulerData As ISchedulerData)
        MyBase.New(appointment, schedulerData)
    End Sub
 
    Protected Overrides Sub CreateRadioToSettingsDictionary()
        Me.radioToSettingsDictionary = New Dictionary(Of RadRadioButton, IRecurrenceRuleSettingsControl)()
 
        Me.radioToSettingsDictionary.Add(Me.radioDaily, New DailyRecurrenceSettings())
        Me.radioToSettingsDictionary.Add(Me.radioWeekly, New UserControl3())
        Me.radioToSettingsDictionary.Add(Me.radioMonthly, New MonthlyRecurrenceSettings())
        Me.radioToSettingsDictionary.Add(Me.radioYearly, New YearlyRecurrenceSettings())
    End Sub
End Class
 
'Subscription for the RecurrenceEditDialogShowing
Me.radScheduler1.RecurrenceEditDialogShowing += New EventHandler(Of RecurrenceEditDialogShowingEventArgs)(radScheduler1_RecurrenceEditDialogShowing)
 
'using overridden EditRecurrenceDialog
Private Sub radScheduler1_RecurrenceEditDialogShowing(sender As Object, e As RecurrenceEditDialogShowingEventArgs)
    e.RecurrenceEditDialog = New recurrenceDlg(e.Appointment, Me.radScheduler1)
End Sub

In case that you have other questions, feel free to write back.

All the best,
Dobry Zranchev
the Telerik team
Check out the Q1 2011 Roadmap for Telerik Controls for Windows Forms.
Tags
Scheduler and Reminder
Asked by
slear
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Tartaruga
Top achievements
Rank 1
Dobry Zranchev
Telerik team
Share this question
or