in a previous post titled embed your images, i described how you can embed images into a class.  


well in this post i will show you a better way to embed those images as well as a configuration file into a class. the class in question is a treeview class first shown here in this post.


the class and sample forms can be downloaded from the link below.


all that is needed to use this class is to run the xmldashbuilder.scx form and configure how the treeview will look. you can add items, link in images for embedding and set commands that will be run when a treeview node is clicked.


pic1  - the builder



pic 2 - the builder with help


then it is simply a matter of dropping the class on a form, sizing it and away you go.


since you have the source you can easily open the class and see how i have done this.


basically the treeview is driven by a table that allows three levels for each node. this should usually be enough. images are linked to each node and are also embedded along with the table into the class itself, so no external files are needed other than the class itself. the builder is not needed once the class has been setup. if later configuration is needed the builder must be in the same directory as the class.


you can place any commands to be run just as you do in a vfp menu. please see the sample commands included in the class by running the builder form.


if you ever need to make changes to the configuration, then just run the builder, make them and save them. they will appear in your form the next time you run it.


due to the requirement of the imagelist activex, the images must be found externally, so the class will extract them automatically into the temp directory as needed at runtime. the class will not delete them so they will be “reused” if the class is used again. if needed, you can easily add this deletion of images in the destroy of the class.


pic 3 - the class on a form

12 feb 2009

i have removed the memberdata entries from the class and form. this class will work in both vfp8 & vfp9. download the attachment below.

2 Responses to Embed II – The Smart VFP Treeview Class

Leave a Reply

Your email address will not be published. Required fields are marked *