Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Expand treeview
Message
 
To
23/04/2002 09:52:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00647884
Message ID:
00648209
Views:
10
>>I am trying to expand my treeview through command button. When the user press the command button, I want the node to expand from a selected point. I have the following code, my only problem is how do I identify the nodekey?
>>
>>*cmdbuttonexpand
>>.OleTreeView.nodes(.llnode).expanded = .t.
>>
>>In my OleTreeView.nodeclick I have the following code:
>>
>>*OleTreeView.nodeclick()
>>LPARAMETERS node
>>WITH thisform
>> .nodevalue = .OleTreeView.selectedItem.fullpath
>> .nodevalue = STRTRAN(.nodevalue,'\',' ')
>> .nodepath = .OleTreeView.selectedItem.fullpath
>> .llnode = node
>>ENDWITH
>>
>>I set the "node" to ".llnode" assuming that is the key, but it dosen't work. Where can I set the nodekey to a property so I can pass it in my expand command or I should say how do find the parameter llnode.
>>
>>Thanks
>>Nick Patel
>
>Nick,
>You already have a reference to node (SelectedItem). IOW :
>
>oNode = tv.SelectedItem
>oNode.Key = tv.SelectedItem.Key
>
>and so forth.
>
>
>* Tv custom expandall method
>  Procedure ExpandAll
>  Lparameters tnIndex
>  Local lnIndex
>  With this
>    .Nodes(tnIndex).Expanded = .t.
>    If .Nodes(tnIndex).Children > 0
>      lnIndex  = .Nodes(tnIndex).Child.Index
>      .ExpandAll(lnIndex)
>      Do while lnIndex # .Nodes(tnIndex).Child.LastSibling.Index
>        lnIndex = .Nodes(lnIndex).Next.Index
>        .ExpandAll(lnIndex)
>      Enddo
>    Endif
>  Endwith
>Endproc
>
>* ExpandAll CommandButton.click
>With thisform.tv
> .ExpandAll(.SelectedItem.Index)
>Endwith
>
Would expand all subnodes of selected node.
>PS: There is a recursif call that doesn't check if recursion goes beyond allowable limit (max 128 do nesting).
>Cetin

Thanks for replying Cetin, I am getting an OLE Error Code 0x8002006: Unknown Name when I call the expand routine in my command button as follows:
* Expand.click
With thisform.OleTreeView
 .ExpandAll(.SelectedItem.Index)
Endwith
I did put your sample code in procedure. I don't have to really do anything in the OleTreeView.nodeclick since .SelectedItem.Index should be already picked up from Thisform.OleTreeView when I select a node, right? I have create always methods and have never used procedures, .ExpandAll should have worked, but apparently it doesn't seem to like it.

Thanks
Nick Patel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform