
DocumentCache Object
241
DocumentCache Object
It is very important to understand the DocumentCache object when using the
VTOM. Although the Visual Tools enable you to open dozens of files at once, only the
active document stays in memory. When a document becomes inactive, that is, when
the user switches to a different document in the Document window, the previously
active document is cached to conserve resources.
Every open document has an element in the
Application.DocumentCache
array. To
refer to a specific cached document, use
Application.DocumentCache(Index)
,
where
Index
is the index of the document in the Document tab.
Example
//*********************************************//
//This JScript shows how to loop through the array:
//*******************************************//
var app = Application;
for (idx = 0; idx < app.DocumentCount; idx++) {
sFile = app.DocumentCache(idx).Filename;
}
Example
//*********************************************//
//This VBScript shows how to loop through the array:
//*******************************************//
set app = Application
for idx = 0 to app.DocumentCount - 1
sFile = app.DocumentCache(idx).Filename
next
Example
If you know the filename of an open document, you can retrieve its index by using
the
Application.GetTabIndexForFile
function, like this:
var app = Application;
idx = app.GetTabIndexForFile(‘c:\docs\file.htm’);
bReadOnly = app.DocumentCache(idx).ReadOnly;
To access more information about a cached document, you must first make it the
active document and refer to it using the Application object’s
ActiveDocument
property. To do this, set the
Application.DocumentIndex
property to the index of
the cached document.
Properties
Filename
Syntax
Filename: OleString (read-only)
Description
Filename of the cached document.
Содержание COLDFUSION STUDIO 5-USING COLDFUSION 5...
Страница 18: ...xviii About This Book...
Страница 26: ...8 Chapter 1 Setting Up the Product...
Страница 42: ...24 Chapter 2 Configuring Browsers and Servers...
Страница 60: ...42 Chapter 3 Exploring the Workspace...
Страница 100: ...82 Chapter 6 Editing Pages...
Страница 126: ...108 Chapter 7 Using Web Development Languages...
Страница 212: ...194 Chapter 13 Customizing the Development Environment...
Страница 320: ...302 Glossary...