RE: HOW TO: Treeview, obtain the first node index in a sorted Tree
- From: Dale Fye <dale.fye@xxxxxxxxxx>
- Date: Tue, 21 Aug 2007 07:16:02 -0700
Kevin,
You should also be able to use the keyvalue in the Nodes() collection. It
looks like you are using "a" & [UC_Code] to denote the key value, so if you
have a query that identify's the root nodes, you should be able to sort that
query alphabetically and determine the [UC_Code] associated with that first
node (I think your varReturn does that). I tried the following from the
debug window in one of my applications, and it expanded the tree to make the
appropriate node ("a123") visible.
me.tvw_Tree.object.nodes("a123").EnsureVisible
HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.
"Kevin McCartney" wrote:
Ended up cheating by using a query to return the first ancestor and then look.
for it in the treeview to return its index.
varRETURN = "a" & Format(DLookup("[UC_CODE]",
"[qselCLIENT_HIERARCHY_FIRST]"), "000000000000")
For Each nodCurrent In objTree.Nodes
If nodCurrent.Key = varRETURN Then
NodeIndex = nodCurrent.Index
Exit For
End If
Next
objTree.Nodes(NodeIndex).EnsureVisible
"Kevin McCartney" wrote:
No that won't work, bjTree.Nodes(1) would be the first item to be added to
the tree and if it the text started with a Z it would appear at the bottom.
What i need is bjTree.Nodes(X), where X is the first item in the tree once
it has been sorted.
Thanks anyway for trying, just hope someone else might have the write answer
and does think this questions is now correctly answered and therefore closed,
so I may have to post the same question again.
"swas" wrote:
Kevin,
Try bjTree.Nodes(1).Root.FirstSibling.EnsureVisible
That should get you there regardless of where bjTree.Nodes(1) is
Regards
swas
"Kevin McCartney" wrote:
Hi TWIMC
I have a treeview that is populated by an query that is sorted so that
parents are added before their associated siblings, thus my source data is
not alphabetically sorted like the treeview appears on the form. Hence is I
use the statement bjTree.Nodes(1).EnsureVisible it doesn't show the viewable
first node in the treeview it shows the node that was added to the treeview
first.
So can anyone tell me what the correct syntax is to ascertain the Index
value of the first 'visible' nodes is, thanks.
I expect it to be simple but I think is one of those, 'Can't see the wood
for the trees'
TIA
KM
- References:
- RE: HOW TO: Treeview, obtain the first node index in a sorted Tree
- From: Kevin McCartney
- RE: HOW TO: Treeview, obtain the first node index in a sorted Tree
- Prev by Date: 'REFRESH' Button In Access 2007 Form
- Next by Date: RE: Lock Subform
- Previous by thread: RE: HOW TO: Treeview, obtain the first node index in a sorted Tree
- Next by thread: Listbox columns
- Index(es):
Relevant Pages
|