Foxtools – Editor _EDGETENV

Version: 01.50.10 - last Update: Tuesday, October 13, 2009, 13:10:00

Previous ChapterFoxtools Home (Alphabetical TOC)Foxtools Home (Grouped TOC)Next Chapter See also:_EdSetEnv | _EdProcList | _EdProperties


Foxtools Editor Support Functions

_EDGETENV

_EdGetEnv() Returns the environment settings for the editor session passed in <nWHAND> parameter.

VFP Syntax

nSuccess = _EdGetEnv(nWHAND, @aEdEnv)

Parameters

[in] nWHAND

Fox-window handle of the editor session in question. If nWHANDL is no valid editor-session handle, <0> := error is returned.

[out] aEdEnv

An one-dimensional Array with 25 elements that holds the environment settings. Must be passed in by reference.

Returns

Numeric. <1> := Success | <0> := Error!

aEdEnv array content is (green := read/write | red := read only):

Index (Type) Element content
1 (C) File name
2 (N) File size
3 (N) Maximum file size (0 = infinite)
4 (N) Text buffer dirty? (0 = No, 1 = Yes)
5 (N) Auto Indent? (0 = No, 1 = Yes)
6 (N) Make backup? (0 = No, 1 = Yes)
7 (N) Add Linefeeds when saved (0 = No, 1 = Yes)
8 (N) Auto-compile? (0 = No, 1 = Yes)
9 (N) Add CTRL+Z at end of file? (0 = No, 1 = Yes)
10 (N) Save preferences? (0 = No, 1 = Yes)
11 (N) Allow Drag/Drop? (0 = No, 1 = Yes)
12 (N) Read-Only?
   0 = No
   1 = Yes
   2 = Read/Write opened as read-only
   3 = Read-Only opened as read-only
13 (N) Display Status Bar? (0 = No, 2 = Yes)
14 (N) Update preferences? (0 = No, 1 = Yes)  << This entry always shows <1> although, using <0> with _EdSetEnv() changes the setting!
15 (N) Insert Mode? (0 = No, 1 = Yes)
16 (N) Wrap Words? If less than 0, new line at return only
17 (N) Selection Start
18 (N) Selection End
19 (N) Selection Anchor point
20 (N) Justification (0 = Left, 1 = Right, 2 = Center)
21 (N) Tab size in spaces
22 (C) Font name
23 (N) Font size
24 (N) Font style (0 = plain, 1 = bold, 2 = italic, 3 = bold italic)
25 (N) Kind of editor session – defined in pro_ext.h

#define ED_COMMAND    0
#define ED_SCRIP    ED_COMMAND
#define ED_PROGRAM 1
#define ED_FILE        2
#define ED_MEMO        3
#define ED_QUERY    6
#define ED_SCREEN    7
#define ED_MENU        8
#define ED_VIEW        9
#define ED_SNIP        10
#define ED_TEXT        11
#define ED_PROC        12
#define ED_PROJTEXT  13

Constraints

Some VFP 9.0 specific enhancements like syntax colouring are not returned. Thus, cannot be queried/modified using this technique.

Remarks

The array must be dimensioned correctly before calling _EdGetEnv() otherwise an error “Array argument not of proper size” is thrown. Use _EdGetEnv() to test if a FoxPro Win-Handle belongs to an active editor session like this: IF _EdGetEnv(m.nWHAND, @aDummy) = 1 THEN >> valid editor session handle. Once the array content is created you can reuse the array in _EdSetEnv(m.nWHAND, @aEdEnv) to modify some editor environment settings. The green elements above are read/write, the red ones are read only.

VFP Example(s)

Opening an editor session, returning character right from the caret:

*\\ Open editor session
nWHAND =_EDOPENFIL("TEST.TXT", 1)
*\\ Dimension environment array
LOCAL ARRAY aEdEnv[25]
*\\ Get editor session environment
IF _EDGETENV(m.nWHAND, @aEdEnv) = 1
   DISPLAY MEMORY LIKE aEdEnv
ELSE
   ? "No valid editor session handle"
ENDIF
*\\ Close editor session
= _EDCLOSEFI(m.nWHAND, 0)
*//

Previous ChapterFoxtools Home (Alphabetical TOC)Foxtools Home (Grouped TOC)Next Chapter