CanEditDoc

Description:              This function returns an indication as to whether or not the document for the given module can be edited.

Warning:               This function should be used by advanced programmers only.

Returns:                    Boolean

Usage:                       Script

Format:                      CanEditDoc(Module [, ErrCode])

Parameters:             Module    { module }  { required }  { no default: }

                                                Any module value that specifies the document that you wish to modify.

                                    ErrCode    { numeric }  { optional }  { no default: }

                                                An optional parameter that gets set to a non-zero value when CanEditDoc returns a 1. The return value is a collection of 3 bits:

Value

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());

[

  IfElse(CanEditDoc(CurrentWindow()),

         editFlag = 1, 

         editFlag = 0); 

]

This script will be executed as soon as its state becomes active, and then every time the mouse moves over a new window; the flag called editFlag will indicate whether or not editing can be done in the window that the mouse is over.

See Also:

ResyncDoc