File

This object is the building block for projects. Every project contains a Files collection composed of File objects. Each File object represents one file (or group of files, like a form) in the project.

Property

Value

Purpose

CodePage

Numeric

The codepage for this file.

Description

Character

The description saved for this file. The description appears in the bottom panel of the Project Manager when the file has focus.

Exclude

Logical

Indicates whether the file is to be included in an APP or EXE built from the project. Actually, indicates whether it should be excluded.

FileClass, FileClassLibrary

Character

If the file is a form, these two indicate the name and library of the class it's based on. If the file is not a form, each contains an empty string.

LastModified

DateTime

The date and time at which the file was last changed.

Name

Character

The filename, including the path.

ReadOnly

Logical

This property tells you if the file can be edited. ReadOnly is .T. if the file is checked in under source code control or if it is flagged Read-Only. ReadOnly cannot be directly changed—you need to either check out the file or clear the Read-Only attribute to toggle this property.

SCCStatus

Numeric

Indicates the file's status with the project's source control provider. If there is no source control provider, contains 0.

Type

Single character

Indicates what kind of file this is.


Method

Purpose

AddToSCC

Adds the file to the project's source control provider.

CheckIn

Checks the file into the source control provider.

CheckOut

Checks the file out of the source control provider.

GetLatestVersion

Brings a read-only copy of the file in its current state to the local drive.

Modify

Opens the file in its native editing tool.

Remove

Removes the file from the project, optionally deleting it from the disk as well.

RemoveFromSCC

Removes the file from source control.

Run

Runs the file. For reports, previews the file.

UndoCheckOut

Changes the file's source control status to checked in, discarding any changes since checkout.


It might seem that there's a method missing from the list—Add. But you can't apply Add to a file object because there is no such object at the time you're adding the file. So Add is a Files collection method.File, like Project, is a COM class, not a native VFP class. This means, among other things, that it has no events. It also means we can't subclass it, because we have no control over the creation of File objects. It happens automatically when a project is opened or when a file is added to a project.

Example

* See what's in a project
FOR EACH oFile IN _VFP.ActiveProject.Files
   ? oFile.Name, oFile.Type
ENDFOR

See Also

AddToSCC, CheckIn, CheckOut, CodePage, Description, Exclude, FileClass, FileClassLibrary, Files, GetLatestVersion, LastModified, Modify, Name, Project, ReadOnly, Remove, RemoveFromSCC, Run Method, SCCStatus, Type Property, UndoCheckOut


Back to Table of Contents

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