|
Infralution Support Support groups for Infralution products
|
View previous topic :: View next topic |
Author |
Message |
keesp Guest
|
Posted: Thu Jun 23, 2005 11:12 am Post subject: 'deep' null reference exception when using UniversalEditBox |
|
|
Hi,
I am using a UniversalEditBox to edit data in my tree. If I change a value, say an int or double, and do NOT press enter, but instead point the mouse to another location in the tree (the editor is set to operate on "ValueChanged" events:
cellData.Editor.UpdateValueEventName = "ValueChanged"
then I get a null reference exception from somewhere very deep:
Stacktrace:
at System.Windows.Forms.ContainerControl.ValidateThroughAncestor(Control ancestorControl)
at System.Windows.Forms.ContainerControl.EnterValidation(Control enterControl)
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control)
at System.Windows.Forms.Control.WmSetFocus(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 System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SetFocus(HandleRef hWnd)
at System.Windows.Forms.Control.FocusInternal()
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at EcoChemie.NovaCV.Start.Main(String[] args) in c:\products\nova\novacv\source\ecochemie.novacv\start.cs:line 321
ToString:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.ContainerControl.ValidateThroughAncestor(Control ancestorControl)
at System.Windows.Forms.ContainerControl.EnterValidation(Control enterControl)
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control)
at System.Windows.Forms.Control.WmSetFocus(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 System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SetFocus(HandleRef hWnd)
at System.Windows.Forms.Control.FocusInternal()
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at EcoChemie.NovaCV.Start.Main(String[] args) in c:\products\nova\novacv\source\ecochemie.novacv\start.cs:line 321
I am overriding the setValue method of the ObjectCellBinding but this seems to go okay. The exception occurs after the system as completed this method.
Any clues?
Thanks,
Kees |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Jun 23, 2005 11:31 pm Post subject: |
|
|
You're right - that is very deep
If you could send us a zipped sample project which demonstrates the problem it would help enormously in tracking down the source of the problem.
A possible work around is to use a numeric up down control as the editor for these. _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jun 27, 2005 10:11 am Post subject: |
|
|
We received your sample project and identified the problem – calling UpdateRows from inside the SetValue event. The problem is that SetValue is being called ultimately as the UniversalEditBox is losing focus – and calling UpdateRows causes the entire Tree to be rebuilt (including editors) this is causing windows to lose the plot as far focus goes.
There are several possible solutions:
1. Use VirtualTree.UpdateRowData – this just updates the displayed row information and does not rebuild the hierarchy. This is more efficient then calling UpdateRows and will probably do what you want as far as refreshing other related data.
2. Use a TextBox as an editor rather than UniversalEditBox and hook SetValue to the TextChanged event. This will avoid your handler being called during change of focus. _________________ Infralution Support |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|