disable / remove inline editor?

8 posts, 0 answers
  1. Patrick
    Patrick avatar
    14 posts
    Member since:
    Feb 2011

    Posted 09 May 2011 Link to this post

    Hi,

    like the title it says. is there a property / way to disable the inline editor? Cant find such an option.


    greetz
  2. Sean Overman
    Sean Overman avatar
    31 posts
    Member since:
    Sep 2012

    Posted 09 May 2011 Link to this post

    I literally just got a answer for this from my telerik support ticket.

    You need to implement your own SchedulerEditManager like follows:

    class MySchedulerEditManager : SchedulerEditManager {
        public MySchedulerEditManager(RadSchedulerElement element) : base(element) { }
     
        public override bool BeginInlineEdit() {
            SchedulerVisualElement sve = this.SchedulerElement.ViewElement;
     
            if (sve is SchedulerDayViewGroupedByResourceElement) {
                foreach (SchedulerDayViewElement dv in ((SchedulerDayViewGroupedByResourceElement)sve).GetDayViewElements()) {
                    dv.View.UpdateAppointments(this.SchedulerElement.Scheduler.Appointments);
                }
            } else if (sve is SchedulerMonthViewGroupedByResourceElement) {
                foreach (SchedulerMonthViewElement mv in ((SchedulerMonthViewGroupedByResourceElement)sve).GetMonthViewElements()) {
                    mv.View.UpdateAppointments(this.SchedulerElement.Scheduler.Appointments);
     
                    FieldInfo fi = mv.MonthViewAreaElement.GetType().GetField("appointments", BindingFlags.Instance | BindingFlags.NonPublic);
                    List<AppointmentElement> appointments = (List<AppointmentElement>)fi.GetValue(mv.MonthViewAreaElement);
                    for (int i = appointments.Count - 1; i >= 0; i--) {
                        if (!mv.View.Appointments.Contains(appointments[i].Appointment)) {
                            appointments.RemoveAt(i);
                        }
                    }
                }
            }
     
            return false;
        }
    }


    then attached your class to the Scheduler.
    this.RadScheduler1.SchedulerElement.EditorManager = new MySchedulerEditManager(this.RadScheduler1.SchedulerElement);

    you may have to modify/extend this class, as I use groupmode = resource exclusively, and dont have to check for

    SchedulerDayView, SchedulerWeekView, etc...

    hope that helps.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Patrick
    Patrick avatar
    14 posts
    Member since:
    Feb 2011

    Posted 10 May 2011 Link to this post

    that doesnt work for me. i always get a nullreference exception ;( even when i remove all your code except the constructor.

    greets
  5. Sean Overman
    Sean Overman avatar
    31 posts
    Member since:
    Sep 2012

    Posted 10 May 2011 Link to this post

    are you passing an instance of the schedulerelement to the cotr?

    this.RadScheduler1.SchedulerElement.EditorManager = new MySchedulerEditManager(this.RadScheduler1.SchedulerElement);
  6. Patrick
    Patrick avatar
    14 posts
    Member since:
    Feb 2011

    Posted 12 May 2011 Link to this post

    yes i did :)
    even if i haven't passed it. why should i get a nullpointer exception? :)

    greets
  7. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 12 May 2011 Link to this post

    Hello Patrick,

    Thank you for writing.

    Currently, there is no property that allows for stopping the inline editor. However, such a feature was already requested in this PITS item. Feel free to add your vote to this request as well.

    Meanwhile, to stop the inline editors, you have to override the SchedulerEditManager, and override the BeginInlineEdit method. Using this approach, appointments will not be created when starting to type in the scheduler cells, but the selection will be lost. However, we are planning to improve this functionality in one of the next releases. Here is the implementation needed to achieve this functionality: 
    public Form1()
           {
               InitializeComponent();
               radScheduler1.SchedulerElement.EditorManager = new MySchedulerEditManager(radScheduler1.SchedulerElement);
           }
     
           class MySchedulerEditManager : SchedulerEditManager
           {
               public MySchedulerEditManager(RadSchedulerElement element) : base(element) { }
     
               public override bool BeginInlineEdit()
               {
                   this.SchedulerElement.View.UpdateAppointments(this.SchedulerElement.Scheduler.Appointments);
                   return false;
               }
           }

    I hope that you find the provided information helpful. Should you have any other questions, do not hesitate to contact us.
     
    Best wishes,
    Stefan
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  8. Marty
    Marty avatar
    1 posts
    Member since:
    Jun 2011

    Posted 18 Jun 2011 Link to this post

    Maybe i'm missing something too but, do you mean  public SchedulerEditManager editManager { get; set; } ?
    This works as expected for me, but the property 'EditorManager' just gives me null pointer issues like doesn't exist in the dll or something..
    Maybe i've got an old version or something?
  9. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 22 Jun 2011 Link to this post

    Hi Marty,

    The provided code is for Q1 2011 SP1. Please make sure that you are using this version and the code will work correctly. Let me know whether it works for you.
     
    Regards,
    Stefan
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Back to Top
UI for WinForms is Visual Studio 2017 Ready