_EdGetEnv( ) API Library Routine

See Also   Example

_EdGetEnv( ) provides the editor environment information in *EDENV.

Syntax

int _EdGetEnv(WHANDLE wh, *EDENV theEdEnv)
WHANDLE wh;            /* Handle of editing window. */
*EDENV theEdEnv;         /* Environment settings. */

Remarks

The structure of *EDENV is listed below.

Note   In the comments below, an (R) indicates that this member is read-only and can't be set using _EdSetEnv( ). A (B) indicates that this member takes on one of two Boolean values: 1 (True) or 0 (False).

typedef struct
{
  char            filename[MAXFILENAME];   // (R)
  EDPOS         length;         // # of bytes in text. (R)
  unsigned short   lenLimit;         // Max allowable length. 0 = infinite.

  unsigned short   dirty,            // Has the file been changed? (R, B)
                 autoIndent,      // Auto indent? (B)
                 backup,         // Make backup files? (B)
                 addLineFeeds,   // Add line feeds when saving? (B)
                 autoCompile,      // Shall we auto compile this thing? (B)
                 addCtrlZ,         // Add end of file ctrl-z? (B)
                 savePrefs,      // Save edit preferences? (B)
                 dragAndDrop,   // Allow drag-and-drop. (B)
                 readOnly,         // 0 = not r/o, 1 = file is r/o,
                                // 2 = file is r/w, opened r/o,
                                // 3 = file is r/o, opened r/o. (R)
                 status,            // Display status bar? (B)
                 lockPrefs,         // Can update the preferences ? (B)
                 insertMode;      // (B)

  short            wrap;            // If < 0, new line at Return only.
  EDPOS         selStart;         // Selection start. (R)
  EDPOS         selEnd;         // Selection end. (R)
  EDPOS         selAnchor;      // Selection anchor point. (R)
  short            justMode;      // Justification (0 = left, 1 = right, 2 = center).
  short            tabWidth;      // TAB size in spaces.

   char            fontName[MAXFONTNAME];
  short            fontSize;
  short            fontStyle;      // 0 = plain, 1 = bold, 2 = italic, 3 = bold italic.
  short            kind;         // Kind of editor session (R);
                             // EDCOMMAND, EDPROGRAM, etc.
} EDENV;

1 is returned if called in a Command or Editor session, otherwise 0 is returned.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, Accessing the Visual FoxPro API, in the Programmer's Guide.