Partilhar via


EDITSOURCE( ) Function

Opens the Visual FoxPro editor and, optionally positions the cursor. Required by Editor Tasklist Shortcuts.

EditSource(cShortCutID | [ cFilename [, nLineNo] [, cClassName] 
[, cMethodName|cProcName]])

Parameters

  • cShortCutID
    Specifies the valid shortcut ID
  • cFileName
    Specifies the name of the file to open. If the file is already open, Visual FoxPro activates it.
  • nLineNo
    Specifies the line at which to position the cursor. If you use 0, the cursor is positioned at the last location saved in the resource file. If you provide an invalid or non-existent nlineno, the cursor is positioned at the beginning of the current file. A negative nlineno value will generate an error.
  • cClassName
    Specifies the name of a class or data environment to be edited. If you open a class file (.vcx) without naming a class, the Class Designer opens instead of the editor.
  • cMethodName
    Specifies the name of a method to be edited. Use a valid object-referenced method in the form cObject.nMethodName.
  • cProcName
    Specifies the name of a procedure to be edited in a class type file (.vcx, .scx, .frx, .lbx).

Return Values

Logical. Returns true (.T.) if the target file opens successfully, otherwise returns error codes according to the following table:

Value Description
0 Successful file opening.
132, 705 File in use. Cannot be opened.
200 File not opened due to invalid object reference. Verify the presence of cMethodName in the object referenced by the cClassName parameter.
901, 925 File opened but invalid object reference in cMethodName. Check the reference in the cMethodName parameter. Use a reference such as MyForm.MyList.CLICK. Forms and classes return 925; reports return 901.

Remarks

You can pass cShortCutID without any additional information and have the editor open at that location. The cShortCutID is the unique ID value for a shortcut record stored in the Foxtask system table (_VFP.FoxTask). The Task List application uses this table to ensure that it can get the latest line position of the shortcut. Visual FoxPro maintains, internally, current shortcut information, but only writes line position updates to Foxtask when a file is saved.

The file extension determines which Visual FoxPro editor opens, according to the following table:

Extension Editor Default Settings
PRG Text Editor MODIFY COMMAND
MPR Text Editor MODIFY COMMAND
QPR Text Editor MODIFY COMMAND
TXT Text Editor MODIFY FILE
SCX Code Snippet MODIFY FORM
VCX Code Snippet MODIFY CLASS
FRX Code Snippet MODIFY REPORT
LBX Code Snippet MODIFY LABEL
MNX Menu Snippet MODIFY MENU
DBC Stored Procedures MODIFY PROCEDURE
<other> Text Editor MODIFY FILE

Program (.prg), database (.dbc stored procedures) and text files support only the nLineNo parameter.

Menu file (.mnx) are opened as text files without reference to objects or to line numbers.

See Also

MODIFY Command | APROCINFO( ) Function