The information in this article applies to:
SUMMARY
Visual FoxPro 5.0 or later, ships with the TreeView control that is one of
the controls in the Comctl32.ocx. When you use the TreevView control in a
Visual FoxPro application, several issues may prevent you from using all
the features of the control. However, you can work around the problems by
creating an ActiveX control in Visual Basic 5.0 that acts as a wrapper for
the TreeView control.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: Treewrap.exeFor more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. The TreeView control example illustrates some basics of using and manipulating the TreeView control. Because Visual FoxPro does not handle some of the methods and properties of the TreeView control, this example uses an ActiveX control written in Visual Basic that acts as a wrapper for the TreeView control. The example also shows how to add Nodes to the control using the five different relationship settings of the Nodes Collection Add Method. The sample code also allows you to remove a selected Node or branch. The main focus of the example is to show how to save and restore the Nodes in a FoxPro table. The algorithm used saves the Nodes in viewing order. This allows you to save and restore the TreeView control with the Nodes in the same order that the user was viewing them when the application closed. The sample file also illustrates dragging and dropping of the Nodes. The code allows you to drag a Node and drop it on top of a different Node so that the dragged Node is now the child of the Node on which it was dropped on. The drag and drop code was written into the wrapper control with Visual Basic. The wrapper control then exposes the necessary properties, methods, and events so that you can use the control in Visual FoxPro. An Imagelist control is also included in the wrapper control to give you the ability to assign an image to the nodes. NOTE: To use this sample in FoxPro, you need to issue a SYS(2333,0) before you open or run the TreeView form. You will also need to use Regsvr32.exe and register the Vbtofox.ocx before you use the .ocx file. (It does not matter where the .ocx file is located for this example to work.) The syntax for using Regsvr32.exe is as follows:
where:
/u means Unregister the .ocx File /s means Silent Mode (display no messages)If you build the .ocx file in Visual Basic, it will register the control for you. The default in Visual Basic is to give the control a new class ID every time the control is rebuilt. This can cause errors in Visual FoxPro because it may be looking for a version of the control with a different class ID. To use this sample, you will need to have Visual Basic 5.0 and Visual FoxPro 5.0 installed on your system. This sample has not been tested on a machine that did not have both Visual Basic and Visual FoxPro installed. Here are the steps to run the sample:
REFERENCES
For more information on the TreeView control see the Online Help.
Additional query words:
Keywords : kbfile kbsample kbVFp500 kbVFp600 kbDSupport |
Last Reviewed: December 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |