Hi Cetin
Thanks for your reply. I think I get it now...If I use the mouse or keyboard the nodecheck event will fire. But if I have it in code, it doesn't. This is very strange then, because if I click a checkbox the nodecheck event does not fire! I think it was before, but for some reason it stopped working. I am getting VFP 7 tomorrow (hopefully) so it I will see if it will work then.
Chris
>Chris,
>If user checks or unchecks with mouse/keyboard it fires. If you do it in code (ie: OleTree.Nodes('NodeKey').Checked = .t.) then it doesn't.
>
>Create a treeview with checkboxes and insert the code I sent in nodecheck (remove if node.key = 'Root'). When you click a node it fires the code and checks/unchecks children. However setting children checked property doen't fire nodecheck.
>
>Cetin
>
>>Hi Cetin,
>>
>>Thanks for your reply. So if you programatically check or uncheck the checked property the nodechecked event doesn't fire? Then how can we determine if someone checks or unchecks an item?
>>
>>This is how I set it up. 'MakeLink' is a function I've made to determine if the checkboxed should be checked. 'IsExpanded' is a function that determines if the node was previously expanded.
>>
>>scan
>> if empty(tparent)
>> loNode = thisform.acxTreeView.nodes.add(, , alltrim(tname), alltrim(tdescrip))
>> else
>> loNode = thisform.acxTreeView.nodes.add(alltrim(tparent), tnum, alltrim(tname), alltrim(tdescrip))
>> endif
>> if thisform.makelink(alltrim(thisform.txtPid.value), alltrim(tname))
>> loNode.checked = .t.
>> endif
>> if thisform.isexpanded(alltrim(tname))
>> loNode.expanded = .t.
>> endif
>>
>>endscan
>>
>>
>>Thank You Very Much,
>>Chris
>>
>>>Yes Chris,
>>>It fires when a node is checked or unchecked. It doesn't fire if Checked property is set programmatically.
>>>ie: I use this code to automatically check-uncheck child nodes of a root node :
>>>
>>>*** ActiveX Control Event ***
>>>Lparameters node
>>>If node.key = 'Root'
>>> llChecked = node.Checked
>>> If node.Children > 0
>>> Node.Child.Checked = llChecked
>>> lnIndex = Node.Child.Index
>>> Do while lnIndex # Node.Child.LastSibling.Index
>>> this.Nodes(lnIndex).Next.Checked = llChecked
>>> lnIndex = this.Nodes(lnIndex).Next.Index
>>> Enddo
>>> Endif
>>>Endif
>>>
Cetin
>>>