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

PropertyGridSpinEditor causes a crash.

6 Answers 51 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Hugues
Top achievements
Rank 1
Hugues asked on 15 Dec 2014, 04:55 PM
when using PropertyGridSpinEditor up and down arrow to change a value, then clicking on the box value. It cause a crash.

6 Answers, 1 is accepted

Sort by
0
Hugues
Top achievements
Rank 1
answered on 15 Dec 2014, 04:56 PM
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)

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Dec 2014, 03:58 PM
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.

 
0
Hugues
Top achievements
Rank 1
answered on 02 Feb 2015, 09:15 PM
Hi Desilva.
I tried the code snippet that you provided and it is still crashing.
0
Hugues
Top achievements
Rank 1
answered on 02 Feb 2015, 09:17 PM
I am on a tight deadline. So i will roll my own.

Thanks.
0
Hugues
Top achievements
Rank 1
answered on 02 Feb 2015, 09:20 PM
I am really sorry. I made a typo. It works now.

Thanks,
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Feb 2015, 10:04 AM
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.

 
Tags
PropertyGrid
Asked by
Hugues
Top achievements
Rank 1
Answers by
Hugues
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or