environment options
Many of the recent updates relate to the commonly used Environment Options dialog box. The options page of this dialog box was reorganized in Delphi 6, and the Form Designer option was moved from the PReferences page to the new Designer page. §The Preferences page of the Environment Options dialog box has a check box. This check box prevents Delphi windows from automatically docking with each other. §The Environment Variables page allows you to see system environment variables (such as standard pathnames and OS settings) and set user-defined variables. The benefit is that you can use system variables and user-defined variables in every dialog of the IDE - for example, you can avoid the hard-coding usually used for pathnames and replace them with a variable. In other words, environment variables work similarly to the $DELPHI variable, referring to the Delphi base directory, but can be defined by the user. § In Internet pages you can select default file extensions for HTML and xml files (mainly through the WebSnap framework) and associate an external editor with each extension.
About the menu
The main Delphi menu bar (which has a sleeker look in Delphi 7) is an important way to integrate with the IDE, although you'll probably use shortcut keys and shortcut menus for most tasks. The menu bar's reaction to your current actions has changed little: to get the full list of actions you can perform on the current window or component, you right-click. The menu bar changes depending on the third-party tools and wizards you have installed. In Delphi 7, ModelMaker has its own menu. You will see other menus by installing popular plug-ins like GExperts or even my own wizard (see Appendix B, "Extra Delphi Tools from other Sources" and A, "Extra Delphi Tools by the Author" for more details). A related menu that has been added to Delphi in recent versions is the Window menu in the IDE. This menu lists open windows; previously, you could access this list by using the Alt+0 key or the View ? Window List menu item. This window menu is really convenient because some windows are often hidden behind other windows and difficult to find. You can control the alphabetical ordering of this menu by using a setting in the Windows registry: Look for the Delphi Main Window subkey (under HKEY_CURRENT_USER/Software/Borland/Delphi/7.0). This registration key uses a string (instead of a Boolean value), where '-1' and 'True' represent true, and '0' and 'False' represent false.
| Skill | In Delphi 7, the Window menu ends with a new command: Next Window. This command is particularly useful in the form of a shortcut key: Alt+End. Jumping through an IDE's various windows has never been easier (at least, not without add-on tools). |
Environment Options Dialog
As I've already discussed, some IDE settings require you to edit the registry directly. I'll discuss these settings a little more in this chapter. Of course, the most common settings can be easily adjusted using the Environment Options dialog box, which is available from the Tools menu along with the Editor Options and Debugger Options. Most settings are very intuitive and fully described in the Delphi help file. Figure 1.2 shows my standard settings for the Preferences page of this dialog box.
Figure 1.2: Preferences page of Environment Options dialog box
To-Do List
Another feature that was added to Delphi 5 but is still underutilized is the to-do list. This is a list of the tasks for the project that you still have to complete - a collection of notes for programmers (or programmers; this tool is very useful in teams). Although the idea is not new, the key concept of to-do list in Delphi is that it works as a two-way tool. You can add or modify to-do items by adding special TODO comments to the source code of any file in a project; you will then see the corresponding entries in the list. Additionally, you can visually edit items in the list to modify corresponding source code comments. For example, here's how a to-do listitem might look in source code:
procedure TForm1.FormCreate(Sender: TObject);
begin
// TODO -oMarco: Add creation code
end ;
The same options can be edited visually in the window shown in Figure 1.3, along with the To-Do List window.
Figure 1.3: The Edit To-Do Item window can be used to modify a to-do option, an operation you can also do directly in the source code. The exception to this two-way rule is the definition of project-wide to-do items. You must add these items directly to the list. To do this, you can either use the Ctrl+A key combination in the To-Do List window or right-click the window and select Add from the shortcut menu. These projects are saved in a special file with the same root name as the project file, with the extension .TODO. You can use multiple selections with a TODO comment. You can use -o (as in the previous code excerpt) to indicate the owner (the programmer who entered the comment), the -c option to indicate the classification, or simply a number from 1 to 5 to indicate the priority (0, or no number, indicating that no priority was placed). For example, using the Add To-Do Item command on the editor's shortcut menu (or the Ctrl+Shift+T shortcut) produces this comment:
{ TODO 2 -oMarco : Button pressed }
Delphi treats everything after the bracket—to the end of the line or to the enclosing brace, depending on the type of annotation—as the text of the to-do item. Finally, in the To-Do List window you can check an item to indicate that it has been completed. Source code comments will change from TODO to DONE. You can also manually change comments in the source code to see the display of check marks in the To-Do List window. One of the most powerful elements of this architecture is the To-Do List main window, which allows you to categorize, sort and filter to-do information from source code files as plain text or an HTML Output them to the clipboard as a table. All these options are available on the context menu.
Extended compilation messages and search results in Delphi 7
A small information window appears by default below the editor; it displays compiler information and search results. This window is a fairly significant modification in Delphi 7. First, search results are displayed in separate tabs so that they don't interfere with compiled information as they did in the past. Second, you can ask Delphi to display the results on a different page each time you do a different search, so the results from previous search operations are still available. You can cycle through the tabs in this window using the Alt+Page Down and Alt+Page Up shortcut key combinations. (The same command works for other tabbed views). If a compilation error occurs, you can activate another new window using command View ? Additional Message Info. When you compile a program, the Message Hints information prompt window will provide additional information for some common error messages and provide suggestions on how to correct the errors. This type of help is designed for novice programmers, but it may be convenient to keep this window around. It's important to realize that this information is fully customizable: a project development leader who can put appropriate descriptions of common errors in a form will mean something special to new developers. To do so, follow the recommendations in the file that resides with settings for this feature, which is the msginfo70.ini file in Delphi's bin folder.