CanEditDoc

(Engine-Level Function)

Description: Returns an indication as to whether the document for the given module can be edited.
Warning: This function should be used only by advanced programmers.
Returns: Boolean
Usage: Script Only.
Function Groups: Compilation and On-Line Modifications,  Advanced Module
Related to:  ResyncDoc
Format: CanEditDoc(Module [, ErrCode])
Parameters:  
Module
Required. Any module value that specifies the document that you wish to modify.
ErrCode

Optional. Is set to a non-zero value when CanEditDoc returns a 1. The return value is a collection of 3 bits:

(See: Bitwise Parameters & Operations)

ErrCode

Bit No.

Description

1

0

TRUE if not available (001)

2

1

TRUE if read only (010)

3

2

TRUE if file is out of sync (100)

Comments: This function returns true if the document for the given module can be modified. The function will check to see if the date and time for the document file match that of the run file. It will return false if the document does not exist, if the dates and times are out of sync, or if the document is "Read Only".

Example:

  If Watch(1, CurrentWindow());
  [
    EditFlag = CanEditDoc(CurrentWindow());
  ]

This script will be executed as soon as its state becomes active, and then every time the mouse moves over a new window, EditFlag will indicate whether editing can be done in that window.