View previous topic :: View next topic |
Author |
Message |
Andrew Rowley
Joined: 24 Dec 2005 Posts: 63
|
Posted: Mon May 21, 2007 12:09 am Post subject: Tree occasionally blank |
|
|
I have an occasional problem after I implemented object caching as discussed in this topic: http://www.infralution.com/phpBB2/viewtopic.php?t=873
Once in a while the tree ends up blank.
The root object is an Arraylist, which contains my actual data. When I update the data, the process is:
root->Clear();
root->AddRange(newlist);
tree->UpdateRows();
I know the Arraylist contains the data even when the tree is blank, because I have an export data function that gets its data from tree->DataSource, and this gets the correct data.
The new list is built using the cached objects. If I discard all the old objects and rebuild the tree with new ones, I see the data again.
Any suggestions? I am having difficulty because I can't reliably reproduce it, but you might have more ideas with your knowledge of the tree internals.
Thanks
Andrew Rowley |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon May 21, 2007 3:32 am Post subject: |
|
|
Have you got ShowRootRow set to true? If not it might be worth setting it to true while you are trying to find the problem.
Are you using columns with ContextSensitive set to true? If so you should ensure that you have least one (main) column with ContextSensitive set to false. Otherwise you can get situations where no column is displayed.
If you use tree->UpdateRows(true) does the problem still occur?
Before we can help much more you need to be able to pin down the circumstances under which the problem occurs (and ideally email us a sample project which demonstrates it). _________________ Infralution Support |
|
Back to top |
|
|
Andrew Rowley
Joined: 24 Dec 2005 Posts: 63
|
Posted: Mon May 21, 2007 4:35 am Post subject: |
|
|
ShowRootRow is set to false. ContextSensitive is set to false. My gut feeling is that there is some sort of timing issue updating the tree.
My biggest problem in debugging this and working out how to reproduce it is that it happens very infrequently. I probably see it every couple of weeks.
Whe I first encountered this I didn't discard my object cache in my refresh function. When the problem occurred, refreshing would not fix the problem - I had to restart the application. Now that an explicit refresh in my application discards the cached objects, refreshing does at least fix the problem.
I am wondering whether it could be something to do with the tree EnableRowCaching property. What would be the impact of changing that to false? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon May 21, 2007 5:47 am Post subject: |
|
|
I doubt that the problem is related to EnableRowCaching - but you can try changing this - it should not have any adverse effect.
Are you accessing Virtual Tree from multiple threads? _________________ Infralution Support |
|
Back to top |
|
|
Andrew Rowley
Joined: 24 Dec 2005 Posts: 63
|
Posted: Mon May 21, 2007 6:25 am Post subject: |
|
|
No, only a single thread. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon May 21, 2007 6:53 am Post subject: |
|
|
Are you calling SuspendLayout or SuspendDataUpdate anywhere in your code?
If you are you should ensure that corresponding Resume method MUST be called in all situations (including exceptions). Usually this means putting the Resume call in a try finally block. Missing a resume call in some circumstances can give you blank screens that a very difficult to track down. _________________ Infralution Support |
|
Back to top |
|
|
Andrew Rowley
Joined: 24 Dec 2005 Posts: 63
|
Posted: Mon May 21, 2007 11:43 pm Post subject: |
|
|
No - no SuspendLayout or SuspendDataUpdate calls. |
|
Back to top |
|
|
Andrew Rowley
Joined: 24 Dec 2005 Posts: 63
|
Posted: Tue May 22, 2007 6:50 am Post subject: |
|
|
I just discovered there was some misinformation in my previous description of the problem - to fix the problem with a refresh I had to actually create a new Arraylist for the root. Without a new Arraylist, the tree would not show any data even though it was being added to the old Arraylist.
So UpdateRows() does not fix the problem, but assigning a new datasource does. |
|
Back to top |
|
|
Andrew Rowley
Joined: 24 Dec 2005 Posts: 63
|
Posted: Tue May 22, 2007 7:00 am Post subject: |
|
|
I will try UpdateRows(true) and hope that solves the problem. I had thought that it might not keep the state of the rows (which was the object of the exercise) but it seems to be OK. |
|
Back to top |
|
|
|