Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NullReferenceException from DoubleClick edit

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
amsimmon



Joined: 31 Mar 2006
Posts: 13

PostPosted: Mon May 15, 2006 6:50 pm    Post subject: NullReferenceException from DoubleClick edit Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon May 15, 2006 10:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed May 17, 2006 2:41 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
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