PropertyGridSpinEditor causes a crash.

7 posts, 0 answers
  1. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 15 Dec 2014 Link to this post

    when using PropertyGridSpinEditor up and down arrow to change a value, then clicking on the box value. It cause a crash.
  2. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 15 Dec 2014 Link to this post

    This is the callstack.

    ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.WinControls.UI.RadTextBoxItem.TextBoxControl_MouseEnter(Object sender, EventArgs e)
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnMouseEnter(EventArgs e)
       at System.Windows.Forms.Control.WmMouseEnter(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
       at System.Windows.Forms.TextBox.WndProc(Message& m)
       at Telerik.WinControls.UI.HostedTextBoxBase.WndProc(Message& message)
       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)

  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3469 posts

    Posted 18 Dec 2014 Link to this post

    Hello Hugues,

    Thank you for writing.

    Following the provided description I was able to reproduce the issue you are facing with the specified version 2014.3 1202. I confirm that it is an issue with RadPropertyGrid. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

    I have also updated your Telerik points.

    Currently, the possible solution that I can suggest is to use the following code snippet in the EditorInitialized event:
    private void radPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
    {
        PropertyGridSpinEditor spinEditor = e.Editor as PropertyGridSpinEditor ;
        if (spinEditor != null)
        {
            BaseSpinEditorElement spinEditorElement = spinEditor.EditorElement as BaseSpinEditorElement;
            var eventInfo = spinEditorElement.TextBoxItem.HostedControl.GetType().GetEvent("MouseEnter");
            var methodInfo = spinEditorElement.TextBoxItem.GetType().GetMethod("TextBoxControl_MouseEnter",
                System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            Delegate handler = Delegate.CreateDelegate(typeof(EventHandler), spinEditorElement.TextBoxItem, methodInfo);
            eventInfo.RemoveEventHandler(spinEditorElement.TextBoxItem.HostedControl, handler);
     
            var eventInfo2 = spinEditorElement.TextBoxItem.HostedControl.GetType().GetEvent("MouseLeave");
            var methodInfo2 = spinEditorElement.TextBoxItem.GetType().GetMethod("textBoxItem_MouseLeave",
                System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            Delegate handler2 = Delegate.CreateDelegate(typeof(EventHandler), spinEditorElement.TextBoxItem, methodInfo2);
            eventInfo2.RemoveEventHandler(spinEditorElement.TextBoxItem.HostedControl, handler2);
        }
    }

    I am looking forward to your reply.

    Regards,
    Desislava
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  4. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 02 Feb 2015 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Desilva.
    I tried the code snippet that you provided and it is still crashing.
  5. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 02 Feb 2015 Link to this post

    I am on a tight deadline. So i will roll my own.

    Thanks.
  6. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 02 Feb 2015 in reply to Hugues Link to this post

    I am really sorry. I made a typo. It works now.

    Thanks,
  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3469 posts

    Posted 05 Feb 2015 Link to this post

    Hello Hugues,

    Thank you for writing back.

    I am glad that the suggested solution works for your case. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top