View previous topic :: View next topic |
Author |
Message |
JohnSummit
Joined: 10 Apr 2008 Posts: 32
|
Posted: Wed Jul 08, 2009 5:33 am Post subject: FindRow(leaf node) returns Row for root node. |
|
|
FindRow(leaf node) returns Row for root node. The Item property of the row is set to the Root node. What could be wrong?
My end goal is to obtain the previous leaf node given a current leaf node. If the current leaf node is non-zero it is easy (decrement the child index) but when i have to move to a sibling parent collection it gets a bit more tricky. I was hoping to be able to figure out the previous parent's last leaf node given the first leaf node in the next parent node.... |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Jul 08, 2009 11:30 pm Post subject: |
|
|
If you just want the previous row displayed in the tree then you can use the Row.RowIndex and call VirtualTree.GetRow(Row.RowIndex - 1).
This will only get the previous visible row however. If the previous row is not expanded then you won't traverse to its children. _________________ Infralution Support |
|
Back to top |
|
|
JohnSummit
Joined: 10 Apr 2008 Posts: 32
|
Posted: Mon Jul 13, 2009 12:31 am Post subject: |
|
|
The problem is that anytime i want to retrieve the object for a row via the FindRow function i get the root object back. The parent/child properties of my objects appear to be setup correctly and no warnings are output when debugging. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jul 13, 2009 2:53 am Post subject: |
|
|
Quote: | The problem is that anytime i want to retrieve the object for a row via the FindRow function i get the root object back |
I assume you actually mean:
"anytime i want to retrieve the row for an object"
Since FindRow gives you the Row for a domain object. Which overload version of FindRow are you calling. One of the overloads takes a list of objects (as an IList parameter) which defines the full path to the object you want to find the Row for. If the object you are trying to find the row for happens to support IList then you might be actually calling the wrong overload by accident. To ensure this isn't the case you can force calling the other overloaded method by casting to object eg:
Code: | _virtualTree.FindRow((object)list); |
_________________ Infralution Support |
|
Back to top |
|
|
JohnSummit
Joined: 10 Apr 2008 Posts: 32
|
Posted: Mon Jul 13, 2009 3:34 am Post subject: |
|
|
Good catch! My tree node objects are indeed implementing IList. After an 'object' cast i can now retrieve the row for an arbitrary tree node object. Thanks for your help. |
|
Back to top |
|
|
|