Runrigger
asked on
MS Tree View - manipulation
My Fellow experts, I am working with the Tree View control within an MS Access form.
This tree has various root notes (at the moment we have 6 of them) off of these root nodes we have a number of important immediate child nodes.
The Check box nature of the tree view has been enabled.
What I would like to do is disable checkboxes on two parent nodes (I do know which ones), leaving checkboxes enabled on the 4 remaining parent nodes.
Of the 4 nodes which have check boxes enabled, I then want to disable the check boxes on some (not all) of the child nodes (again, I know which ones).
Is this possible, if so, would you be able to help me with the code.
many thanks
Dave
This tree has various root notes (at the moment we have 6 of them) off of these root nodes we have a number of important immediate child nodes.
The Check box nature of the tree view has been enabled.
What I would like to do is disable checkboxes on two parent nodes (I do know which ones), leaving checkboxes enabled on the 4 remaining parent nodes.
Of the 4 nodes which have check boxes enabled, I then want to disable the check boxes on some (not all) of the child nodes (again, I know which ones).
Is this possible, if so, would you be able to help me with the code.
many thanks
Dave
ASKER
emmm, not great news but something to work with nonetheless!
As an alternatively, I am display them on all nodes, that's fine, however, where I had originally planned to disable them, I have instead tried to make it so that when they check the box, the code automatically unchecks the box;
Private Sub treeAccounts_NodeCheck(ByV al Node As Object)
If Left(Node.Key, 4) = "T001" Then Node.Checked = False
End Sub
however, the box always checks anyway (there doesn't not appear to be a way to "cancel" the checking of the box, so this option doesn't work for me either.
Thoughts?
As an alternatively, I am display them on all nodes, that's fine, however, where I had originally planned to disable them, I have instead tried to make it so that when they check the box, the code automatically unchecks the box;
Private Sub treeAccounts_NodeCheck(ByV
If Left(Node.Key, 4) = "T001" Then Node.Checked = False
End Sub
however, the box always checks anyway (there doesn't not appear to be a way to "cancel" the checking of the box, so this option doesn't work for me either.
Thoughts?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
been there also, as per MS in general their documentation is pretty poor and this doesn't help me any further.
Not sure what to do now as I haven't really learned anything that I didn't already know, do you get the points?
Happy to give them as it confirms that there isn't really anything I don't know, so will stop me exploring any further!
Not sure what to do now as I haven't really learned anything that I didn't already know, do you get the points?
Happy to give them as it confirms that there isn't really anything I don't know, so will stop me exploring any further!
It may be that the TreeView control is not the best interface for your needs -- how about using a MultiSelect listbox in place of the nodes that need to be checked? Perhaps a TreeView could be used for the first level of selection, and then a listbox for the multi-select options.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Helpful, though not entirely what I wanted, thank you guys anyway
You could use the Click or Expand event of a Node to determine if you should show Checkboxes, and then toggle the property based on that, but if you have multiple expanded Nodes, this would not be a visually appealing event.
Or you could use a 3rd party control with more functionality that the MS ones.