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 

Behaviour of Row references when child lists change

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



Joined: 04 Apr 2005
Posts: 69

PostPosted: Wed Apr 27, 2005 12:13 pm    Post subject: Behaviour of Row references when child lists change Reply with quote

How are rows handled when child lists change?

My situation is this: I have a row A with two children B and C:

A
|-- B
|-- C

I now save references to rows B and C. Then the object in A's child list (which implements IBindingList) that corresponds to B is removed. Is the reference to C now invalidated? Maybe the row is replaced by a new one? Whichever, the problem is that C.Item is now null.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Apr 27, 2005 11:26 pm    Post subject: Reply with quote

The section "Working with Rows" in the task based help gives some guidance on this.

Quote:
The lifetime of Row objects is managed by the VirtualTree. In general you should not hold onto references to rows outside of the current call frame (ie don't store row references in member or static variables) because the VirtualTree may decide to dispose of the Row object if it is no longer required. Calling the UpdateRows method will force the VirtualTree to rebuild the row objects from the DataSource and dump any cached rows which are no longer required to support the current display.

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
MHB



Joined: 04 Apr 2005
Posts: 69

PostPosted: Fri Apr 29, 2005 9:39 am    Post subject: Reply with quote

Well, my problem occurs when all of the above is executed inside a method invoked by a user action, so the references are local. I think the problem is that what you are referring to is methods called by the thread(s) that the tree itself creates. Hence, I can never save references from the outside?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sat Apr 30, 2005 8:39 am    Post subject: Reply with quote

In general get the reference to the row object just before you need to use it and you will be fine. If you obtain a reference to a row object then call VirtualTree.UpdateRows then your row reference will have been disposed. Similarly if you obtain a row reference then change a bound data source you may find that the tree has disposed of the rows.
_________________
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