Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Modify

This method belongs to the File object and lets you programmatically open a file from an open project for editing.

Usage

filFile.Modify( [ cClassName ] )

For most of the files in a project, opening the appropriate editor is as simple as calling this method. Modify can even open another application to let you edit its files. For example, if you have a BMP in the project, calling its Modify method opens PaintBrush (or whatever application you have associated with BMP files).

Things are a little more complicated for classes, though. The file that belongs to the project is the class library, not the class itself. So, to edit a particular class, you call the Modify method on the class library and pass the name of the class to be edited. If you omit the class name, the special Open dialog for class libraries comes up to let you choose a class.

When Modify is called, the QueryModifyFile project hook method fires first, if there is one, to determine whether or not Modify should actually proceed. If QueryModifyFile issues NODEFAULT, the Modify is aborted.

Example

* Go through a project and open all the programs for editing
* Assume we have a reference to the project in oProj
FOR EACH oFile IN oProj.Files
   IF oFile.Type = "P"
      oFile.Modify()
   ENDIF
ENDFOR

* Open a particular class.
oProj.Files[3].Modify("frmBase")

See Also

Add, File, Files, Modify Class, Modify Command, Modify Database, Modify File, Modify Form, Modify Label, Modify Menu, Modify Project, Modify Query, Modify Report, Modify Structure, Name, Project, QueryModifyFile, Remove, Type Property