Using a Text Editor in TADS Workbench

TADS Workbench doesn't have a built-in text editor, but it does have a read-only source viewer that shows you the contents of your source files. In addition, TADS Workbench can work with your favorite text editor: when you're viewing a source file with the built-in viewer, TADS Workbench lets you open the file in the text editor program of your choice using a menu command.

Viewing a Source File

To view a file, open the "File" menu and select the "Open..." item. This will open a standard Windows file selector dialog, which lets you select any text file; TADS Workbench will open the text file in a read-only source viewer window.

Alternatively, you can pick one of the source files that's compiled into your game. Open the "File" menu, and select the "Open Source File" item. This will display a submenu listing the source files that make up your game. Select the file that you wish to view.

Note: The list of source files is current as of the last time you compiled and ran your game. If the list is incorrect because you've added a new #include file to your game, you must compile the game and then run it. As soon as TADS Workbench loads the freshly compiled game into the debugger, it will update the source file list. If you don't want to go to all this trouble, you can simply open the source file using the "Open..." command and selecting the file.


Opening a Source File in a Text Editor

If you want to edit a source file, you must first open the file in a source viewer window, as explained above.

Once you've opened your source file in a viewer window, you can send the file to your text editor. There are three ways of opening the file for editing:

All of these methods are equivalent; you can use whichever is most convenient for you.

Configuring your Preferred Text Editor

TADS Workbench uses Notepad as its default text editor. Notepad is a simple editor that is included with the Windows operating system; we chose Notepad as the default editor because it is reasonably safe to assume that Notepad is installed on every Windows machine.

In all likelihood, you will want to use a better text editor than Notepad. Since the choice of a text editor is highly personal, TADS Workbench doesn't attempt to dictate your options; instead, it lets you tell it what editor you want to use.

To configure your preferred text editor, open the "View" menu and select "Options." This will display the TADS Workbench preferences dialog. Click on the "Editor" tab to show the text editor options page.

In the "Editor Program" text field, type in the full filename (with drive and directory path) of your text editor's application program; this will usually be a .EXE file. You can use the "Browse" button to select the application using a standard Windows file selector dialog if you prefer.

In the "Command Line" text field, type the command line arguments for your text editor.

Use a percent sign followed by a lower-case "f" (%f) as a placeholder for the filename to open. For most editors, you should put the %f in double quotes, so that the program interprets a filename that contains a space as a single parameter rather than as two or more space-delimited tokens; however, this is up to the editor to interpret, and some editors don't use this syntax. Notepad, for example, considers the entire command line to be the filename, so no quotes are necessary.

Use a percent sign followed by a lower-case "n" (%n) as a placeholder for the line number to go to. Many programmer's text editors accept a command line option that specifies a line to jump to when first displaying a file; if your editor accepts such an option, you can use %n to specify it. If your editor doesn't accept a starting line option (Notepad doesn't, for example), you don't need to use %n anywhere in your command line.

Use a double percent sign (%%) if you need a single literal percent sign in your command line.

For example, if you use Programmer's File Editor (PFE), a popular freeware text editor that many TADS game authors like, you can configure your editor like this:

Editor Programc:\pfe\pfe32.exe
Command Line/g %n "%f"



Using DDE

Some text editors use DDE ("Dynamic Data Exchange," a mechanism in Windows that applications can use to communicate with each other) to interact with other programs. The main reason that DDE might be of interest is that some editors will start an entirely new application instance (hence a whole new main editor window) each time the editor application is launched, but can be made to share a single instance among several different files using DDE.

Check your editor's documentation to determine if this is of any interest to you; if your editor's documentation doesn't mention DDE, you can ignore this section.

If you're using PFE (see above), you probably don't need to worry about using DDE, even though PFE supports it. PFE always looks for an existing editor instance whenever you launch it, so you don't need to use DDE in order to share a single PFE instance.

In order to use DDE, you need to find three pieces of information in your editor's documentation: the DDE server name; the DDE topic name; and the DDE command string to open a file. This information varies by application; the only way to find it is to consult your editor's documentation.

Once you learn the DDE server, topic, and command string, you can set up TADS Workbench to use DDE to control your editor. Open the Editor preferences dialog as normal. Rather than entering an application name in the "Editor Program" field, click the "Advanced" button. This will bring up a dialog asking you for the DDE server and topic names. Check the "Use DDE" checkbox and enter the server and topic information, then click OK. This will take you back to the main Editor dialog, with the "Editor Program" field set to "DDE:", followed by the server and topic names you entered. Finally, enter the command string for opening a file in the "Command Line" text field; as usual, use %f as a placeholder for the name of the file to open, %n as a placeholder for the line number to go to, and %% for a literal single percent sign.

If you're using Lugaru's Epsilon, you should configure the Editor using DDE, as follows:

Use DDEyes
DDE ServerEpsilon
DDE Topicopen
Command Line+%n "%f"









Copyright ©1999 by Michael J. Roberts.