The Source editor contains the entire source code for the form, report, menu, query, or data module you’re designing. If you’re designing several files, the source for each one appears on a different tabbed page. Likewise for a .PRG file, which appears in the same editor.

Note

If you want, you can choose not to have tabbed pages in the editor but to open more than one instance of the Source editor, instead. Set this preference in the Editor Properties dialog box, Display page (Properties|Editor Properties).

To open the editor, do one of the following:

Design a new or existing form, report, menu, query, or data module. Both the design view and the editor open, with the design view having focus. Press F12 to switch focus to the editor. (If in a prior session you closed the editor, it does not open automatically with the design view, but pressing F12 will open it.)

Right-click a file in the Navigator, and choose Open In Source Editor. (Not all files have this choice.)

Open a .PRG file or text file.

Press F12 when you have a designer open (except the Table designer).

Thereafter, use F12 to toggle between design view and the code page for any given designer file. Changes made in either the Source editor or visual designer are reflected by the other when you move focus between them. Code is automatically compiled when you shift focus to the designer. If an error occurs during compilation, dBASE Plus displays an error message and points to the offending line in the file.

If an error occurs during runtime, dBASE Plus displays a dialog box, giving you the opportunity to fix the error. If you cancel the Fix dialog box, then the only copy of the work is in a temporary disk file which is placed on another page (or another instance) of the editor. You can do with this as you wish.

Starting with dBASE Plus 9 new features were added to make the Source Editor a much more powerful and useful tool. Some of these features include ...

·        End of Line: (now know where the end-of-line mark is)

·        Code Folding: (lots of code, reduce the length and focus on only the code you need)

·        Indentation Guides:  (help better document the code)

·        Line Numbers: (No the exact line number in the code and use in combination with bookmarks)

·        Comment line:  (Simple key-combination for commenting out a line or uncommenting a line - Ctrl+Q)

·        Comment Block:  (Simple key-combination for commenting out a block of code or uncommenting out a block of code - Ctrl+Q on selected lines)

·   Make selection upper case:  (Simple editor tool, make the selected text ALL UPPER CASE)

·  Make selection lower case (Simple editor tool, make the selected text all lower case)

These new features can be changed or added using the Source Editor Properties dialog, the Edit and View menus or by using Key Combinations.

 

Three-pane window with tree view

The Source editor is a Three-pane window:

The left pane is a tree view showing the hierarchy of the current file (including the this object for classes with a constructor). You can enlarge the pane, or you can hide it. To do either one, move the split bar to the left or right, using the mouse. The tree view is dynamically updated during program editing, unless the tree view is closed.

You can expand the nodes in the tree view pane by clicking the plus signs and collapse the nodes by clicking the minus signs, same as in the Windows Explorer. The expanded or collapsed state of nodes and the selected item are maintained in the tree-view pane when you take actions in the right-hand pane.

The tree view displays object bitmaps for the standard controls. You can turn this off in the Editor Properties dialog box, Display page (Properties|Editor Properties).

 

The right side contains the Code pane on top and a Search view pane below. Click an item in the tree view to highlight the first line of that object in code. Double-click an item in the tree view (or select it and press Tab) to jump to the start of that object in the Code pane.


dLocator (Find in File) is a new search engine for finding text in multiple files and producing the results of this search to quickly open files associated with the search.

The dLocator pane (bottom pane) can be sized to make room for more or less of the code. Use the mouse to hover over the divider and move the line to view more or less of the top or bottom pane. NOTE: this pane will not be visible until you do a Find in File search, at which time it will open with the search results.

The dLocator pane will show the results of searches  when doing a Find in File search (Edit | Search | Find in File). The Find in File search option uses a search engine to search through many files. The results in the dLocator pane can then be used to open any file that is found with the search parameters. to open one of the files in the results just double click on the line in the results and it will open the file in the Code view pane above.

You cannot use the Source editor to select an object in the Inspector. You must do that in the design window or in the Inspector, itself.

See also: Abbrevation Expansion, Source Editor Properties File, Code Completion, Editor Properties Appearance Page, Editor Properties Font Page, Editor Properties Editor Page, Open File at Cursor