View previous topic :: View next topic |
Author |
Message |
amsimmon
Joined: 31 Mar 2006 Posts: 13
|
Posted: Mon May 15, 2006 6:50 pm Post subject: NullReferenceException from DoubleClick edit |
|
|
My code displays an edit dialog when an item in the tree is double-clicked. The edit dialog is passed the DataRowView and displays it for editing. If the user clicks ok, the row is updated in the database. If a user doesn't change anything, everything works fine. But, if the user makes any change, the row is updated in the DB, then this error is thrown by the VirtualTree:
Code: |
System.NullReferenceException: Object reference not set to an instance of an object.
at Infralution.Controls.VirtualTree.Row.Reindex(Int32 index)
at Infralution.Controls.VirtualTree.Row.set_Expanded(Boolean value)
at Infralution.Controls.VirtualTree.Row.Expand()
at Infralution.Controls.VirtualTree.RowWidget.ExpandRow()
at Infralution.Controls.VirtualTree.RowWidget.OnDoubleClick(EventArgs e)
|
I am able to avoid this error by creating a new MyVirtualTree class with a MyRowWidget class that just overrides the OnDoubleClick to do nothing. My problem is that this isn't a very clean solution and I'd rather not propogate to other parts of our application if there's a cleaner way to do it.
I understand it's blowing up trying to expand the selection. Is there any way to disable that functionality or at least get around this error without inheriting from the VirtualTree classes? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon May 15, 2006 10:48 pm Post subject: |
|
|
In the current release the only way to stop double click expanding/collapsing is the way you've suggested. The exception is probably occurring because the VirtualTree Row being expanded by the DoubleClick is actually being deleted by the actions of your edit dialog. We will have a look to see whether we can put some protective code in to prevent this causing an exception. The possible problem with this is that in many cases this represents a real error in the application and so we don't necessarily just want ot ignore it quietly. _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed May 17, 2006 2:41 am Post subject: |
|
|
Version 2.5.3 has now been released and now includes a check in the Row.Reindex method that should prevent this exception from occurring. However if you want to avoid the row expanding (as well as editing) when you double click on it you will still need to override the RowWidget.OnDoubleClick method. If you want we can add a feature request to add a property to control this behaviour. _________________ Infralution Support |
|
Back to top |
|
|
|