Type

Every item in a project has some native type, like form, menu, free table, and so forth. The Type property indicates that type.

Usage

cTypeChar = filFile.Type
Each type is indicated by a single character. Some of them make intuitive sense, like "Q" for query or "R" for report. Others are a bit of a stretch, like "D" for free table (that is, "DBF") and "V" for class library ("VCX") and a few make no sense at all: "K" for form? Maybe it stands for "sKreen"? Or maybe it's "Kouldn't find a letter we weren't already using?"You can find the complete list in the Help file.

Type is read-write! You can change the type of a file. VFP seems amazingly immune to weird values in the Type field. We were able to change the type of a program from "P" to "D" and then call the Modify method without trashing the project or crashing VFP. Not only that, but the appropriate editing window opened up. It does make you wonder what the point of the Type field is, though. It also means you need to be pretty careful about code like the example, since Type may not accurately identify the file type. Our view is that changing this property is a really bad idea. Just because they let you doesn't mean you have to do it.


Example

* Use Type to figure out whether or how you want to process 
* each file in a project. Here we'll open forms and programs,
* and ignore everything else.
oProj = _VFP.ActiveProject
FOR EACH oFile IN oProj
   IF oFile.Type $ "PK"  && Program or Form
      oFile.Modify()
   ENDIF
ENDFOR

See Also

File, Project


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .