SAMPLE: Treewrap.exe - Sample TreeView Control in Visual FoxProID: Q176270
|
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.
Code that will not work if written in FoxPro may be written in Visual
Basic. When you create the control, build the functionality needed into the
wrapper control.
The sample file explains how to create the wrapper control in Visual Basic
and expose the different properties, methods, and events to a container
that is using the control. For example, the code that gives a user the
ability to drag and drop nodes in the TreeView control is built in the
wrapper control. There is also an ImageList control inside the wrapper
control so that you can assign images for the TreeView to use.
The following file is available for download from the Microsoft Software Library:
Treewrap.exeFor more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online ServicesThe 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.
Regsvr32 [/u] [/s] <.ocx File Name>
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.
For more information on the TreeView control see the Online Help.
Additional information on creating ActiveX controls in Visual Basic may
be found in the Visual Basic's Component Tools Guide and Books Online.
Visual FoxPro Help; 5.0, 5.0a; search on: TreeView control1
Visual Basic's Component Tools Guide and Books Online; search on: Creating
ActiveX controls in Visual Basic
(c) Microsoft Corporation 1997, All Rights Reserved.
Contributions by Brian Combs, Microsoft Corporation
Additional query words:
Keywords : kbfile kbsample kbVFp500 kbVFp600
Version :
Platform :
Issue type : kbhowto
Last Reviewed: July 28, 1999