Bug Report Q143672
Visible to All Users

An exception occurs when trying to prevent users from double clicking to create a new appointment in the XAF Scheduler Control

created 16 years ago

Hello,
I'm trying to prevent my users from double clicking to create a new appointment in the XAF Scheduler Control. I have created a view controller that looks like the following:
protected override void OnActivated()
        {
            SchedulerControl control = SchedulerHelper.GetScheduler(this.View);
            if (control != null)
            {
                control.OptionsCustomization.AllowAppointmentCreate = UsedAppointmentType.Custom;
                control.AllowAppointmentCreate += new AppointmentOperationEventHandler(control_AllowAppointmentCreate);
            }
            base.OnActivated();
        }
void control_AllowAppointmentCreate(object sender, AppointmentOperationEventArgs e)
        {
            e.Allow = !this.View.ObjectType.IsAbstract;
        }
This works just dandy. But now when I right click on the scheduler I get a null reference exception. How do I prevent my user from creating appointments via double click and still allow the right click functionality? The right click popup menu functions normally if I set the UsedAppointmentType to NonRecurring or All but nothing else.
Below is my error log:
The error occured:
     Type: NullReferenceException
     Message: Object reference not set to an instance of an object.
     Data: 0 entries
     Stack trace:
   at DevExpress.ExpressApp.Scheduler.Win.SchedulerListViewController.scheduler_PreparePopupMenu(Object sender, PreparePopupMenuEventArgs e)
   at DevExpress.XtraScheduler.PreparePopupMenuEventHandler.Invoke(Object sender, PreparePopupMenuEventArgs e)
   at DevExpress.XtraScheduler.SchedulerControl.RaisePreparePopupMenu(PreparePopupMenuEventArgs args)
   at DevExpress.XtraScheduler.SchedulerControl.CreatePopupMenu(Point point)
   at DevExpress.XtraScheduler.SchedulerControl.OnPopupMenu(Point point)
   at DevExpress.XtraScheduler.SchedulerControl.OnWmContextMenu(Message& m)
   at DevExpress.XtraScheduler.SchedulerControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
     InnerException is null

Comments (1)
Dennis Garavsky (DevExpress) 16 years ago

    Hi Duane,
    Thank you for the report and your sample project. We have reproduced the problem, and it has already been fixed in the next version of the suite.
    Unfortunately, there is no easy workaround to this problem other than modifying the XAF sources.
    Thanks,
    Dennis

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.