Version: 01.50.10 - last Update: Tuesday, October 13, 2009, 13:10:00
_EdGetEnv | _EdProcList | _EdProperties
Foxtools Editor Support Functions
_EDSETENV
_EdSetEnv() Sets the environment for the editor session passed in <nWHAND> parameter.
VFP Syntax
nSuccess = _EdSetEnv(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.
[in] 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, 1 = Yes) |
14 | (N) Update preferences? (0 = No, 1 = Yes) |
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 |
Constraints
Only values of the (green) read/writable properties (see list above) can be changed! Some VFP 9.0 specific enhancements like syntax colouring are not returned. Thus, cannot be queried/modified using this technique.
Remarks
Some changes require the editor session window to be redrawn to become visible to the user. For example, changing the editor session’s word wrap setting (see code sample below) will become visible only after a redraw.
VFP Example(s)
Opening an editor session, toggling word wrap:
*\\ Open editor session nWHAND =_EDOPENFIL("TEST.TXT", 1) *\\ Dimension environment array PUBLIC ARRAY aEnv[25] *\\ Get editor session environment IF _EDGETENV(m.nWHAND, @aEnv) = 1 *\\ If word wrap OFF IF aEnv[16] < 0 *\\ Set word wrap ON aEnv[16] = 1 ELSE *\\ Set word wrap OFF aEnv[16] = -1 ENDIF _EDSETENV(m.nWHAND, @aEnv) *\\ Make change visible _SCREEN.LOCKSCREEN = .T. _WZoom(m.nWHAND, 2) _WZoom(m.nWHAND, 1) _SCREEN.LOCKSCREEN = .F. ELSE ? "No valid editor session handle" ENDIF *\\ Close editor session *= _EDCLOSEFI(m.nWHAND, 0) *//