Projects
Projects is a collection (an array
property) that gives you access to all open projects. It's a
property of the _VFP and Application objects.
Usage
|
oProject = appApplication.Projects[ nIndex ]
appApplication.Projects[ nIndex ].Property = uValue
appApplication.Projects[ nIndex ].Method()
|
One of the big changes in VFP 6 is the ability to access
projects and their contents programmatically. This makes it
easier to write all kinds of cool tools to manipulate projects.
The Projects collection is the first step in the process. It
contains one element for each open project. The items in the
collection are Project objects (try saying that one 10 times
fast). The collection's Count property tells you how many there
are.To access the Projects collection, you need to use either the
_VFP variable or the Application object. Projects is an ActiveX
collection, not quite fully native to VFP. In practice, this
means that any errors you get are OLE errors rather than native
VFP errors.Beware: As you open projects, the ones that are
already open get pushed farther and farther down in the
collection. That is, the most recently opened project is
Projects[1] while the first project you opened is at the end of
the collection. However, bringing a project to the front doesn't
change its place in the collection.
Example
|
* Open a few projects.
* Now to see what's open:
FOR EACH oProj IN Application.Projects
?oProj.Name
ENDFOR
* How many projects are open?
? Application.Projects.Count
|
Back to Table of Contents
Copyright © 2002-2018 by Tamar E. Granor,
Ted Roche, Doug Hennig, and Della Martin. Click for license
.