CLEAR MENUS

Modify Command, Modify File

These two commands open a text editing window. Their default behaviors are designed so MODIFY COMMAND (or MODI COMM, as we usually type it) is better for editing program files, while MODIFY FILE (better known as MODI FILE) is better for free-form text.

Usage

MODIFY COMMAND | FILE [ FileName | FileSkel | ? ]      [ NOEDIT | NOMODIFY ] [ NOMENU ]       [ NOWAIT ] [ SAVE ]       [ RANGE nStartChar, nEndChar ]      [ WINDOW DefinitionWindow ]      [ IN [ WINDOW ] ContainerWindow         | IN SCREEN | IN MACDESKTOP ]      [ SAME ]      [ AS nCodePage ]
Most of the clauses for these two are the same as those for MODIFY MEMO. They're discussed there. These two have something else in common with MODIFY MEMO—unlike most of the MODIFY commands in FoxPro, they have no CREATE equivalent. To make a new one, you just specify a file that doesn't exist (not true for MODIFY MEMO, of course).

The AS nCodePage clause lets you indicate that the file was saved under a different code page and needs to be translated as it's opened.

If you pass a file skeleton (that is, a filename including the DOS wildcards "?" and "*"), all files matching that skeleton open for editing. Watch out—opening 100 programs for editing, although fun to watch, can eat an awful lot of memory. If you omit the filename entirely, an empty editing window opens. Beware! When you do that, you can't add any of the other clauses—they're interpreted as the filename. So MODI COMM NOEDIT opens the editor for a file named NOEDIT.PRG rather than giving you an empty, read-only edit window (a pretty stupid thing to do anyway).

MODIFY COMMAND assumes a PRG file unless you specify an extension. MODIFY FILE assumes TXT.

The various characteristics of different kinds of editing windows are controlled by a Properties dialog accessed from the Edit/Properties menu or the context menu of such windows. (In VFP 3, this information was provided in the Edit page of the Tools | Options dialog.) By default, MODI COMM windows don't word-wrap and do automatically indent to match the previous line—two of our favorite characteristics when writing code. MODIFY FILE has the opposite settings for those two, making it much better for, say, creating a README file.

MODI COMM's defaults make it great for displaying output text files. You get both horizontal and vertical scroll bars and you can see the actual format of the data.

Modifying a read-only file and then choosing to save it with File/SaveAs leaves the ridiculous " [read only]" appended to the name as it's offered in the Save As dialog. This cropped up in VFP 5 and is still a problem in later versions.


You can change the characteristics for individual files or the default for an extension in the Properties dialog. Be cautious about changing the word-wrap setting—lots of programs assume that setting is the default. You can also control the default settings using the IDE page of the Tools | Options dialog. That page also lets you override the settings stored for individual files and make all files of the specified type use the default settings.

Example

MODIFY COMMAND MyProg   && Opens MyProg.PRG MODIFY FILE ReadMe      && Opens ReadMe.TXT MODIFY COMMAND Output.TXT NOMODIFY     && Show output

See Also

Do, Low-Level File Functions, Modify Memo, Set TextMerge


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net