Hi,
The information below should get you moving in the right direction.
The method and property names, and sample code are based on
the Delphi/Pascal wrapper for the Windows Treeview. You should
be able to find the equivalents in the VB(A) help for the Treeview.
Essentially, what you want to do is check the status
(checked/unchecked) of a Parent node, then get the Child count,
then walk through the child nodes, setting each accordingly.
Suggestions on finding more info...
- AccessMonster has a number of "Treeview" related links
(
http://www.accessmonster.com )
- I found this link to a demo Treeview on AccessMonster:
(
http://www.pointltd.com/Downloads/Details.asp?dlID=36 )
- You might want to ask your question in the
(Access) formscoding and modulescoding newsgroups
- And of course, the Microsoft website
(
http://microsoft.com)
hth,
John
-------------------------
o) A treeview node has these useful properties:
- HasChildren (returns boolean true/false)
- Count (returns integer, the number of child nodes for *this* node.
- Index (integer, the relative position of the specified node)
- Item (provides access to a child node by its position in the list of
child nodes)
- Selected (returns the current selected node, from which you can
get Index, Text (label (text) value assigned to node), and other
values)
o) And a treeview node has these useful methods:
- GetFirstChild (returns the first child Treenode)
- GetNextChild (etc...)
- GetLastChild
o) If a node has children, they are indexed 0...n, with respect to the
Parent node.
o) Some sample (Delphi) code:
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
begin
{ This will add labels for all the child nodes (of the selected parent node)
into a listbox }
for i := 0 to (MyTreeView.Selected.Count - 1) do
ListBox1.Items.Add(MyTreeView.Selected.Item
.Text);
{ This will display a messagebox for each child, showing the
Index number }
for i := 0 to (MyTreeView.Selected.Count - 1) do
Showmessage('Item: ' + IntToStr(MyTreeView.Selected.Item.Index));
end;
======================
"cehrenre" wrote...
Have a project for work thats driving me nuts! Most of the work is complete
but I have been asked to build a tree view. I figured out how to load the
root and child nodes. I can collapse/expand all as needed via buttons. My
problem is that I have checkboxes=True. I cannot figure out how to have all
the child nodes check boxes set to True if its parent is checked (and
conversely, when the parent is unchecked, then all children should be
unchecked).
This is driving me nuts...Can anyone help me?