[ Pobierz całość w formacie PDF ]
.These links are displayed with the bluecolor and underline style that are typical of Web browsers, and the pointer changes to a handwhenever it s positioned on the link.For example, you can Ctrl+click the TLabel identifier to open its definition in the VCLsource code.As you select references, the editor keeps track of the various positions you vejumped to, and you can move backward and forward among them again as in a Webbrowser.You can also click the drop-down arrows near the Back and Forward buttons to viewa detailed list of the lines of the source code files you ve already jumped to, for more controlover the backward and forward movement.How can you jump directly to the VCL source code if it is not part of your project? TheAppBrowser editor can find not only the units in the Search path (which are compiled as partof the project), but also those in Delphi s Debug Source, Browsing, and Library paths.Thesedirectories are searched in the order I ve just listed, and you can set them in the Directories/Conditionals page of the Project Options dialog box and in the Library page of the Environ-ment Options dialog box.By default, Delphi adds the VCL source code directories in theBrowsing path of the environment.Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c01.qxd 7/2/01 2:40 PM Page 1818 Chapter 1 " The Delphi 6 IDEClass CompletionThe third important feature of Delphi s AppBrowser editor is class completion, activated bypressing the Ctrl+Shift+C key combination.Adding an event handler to an application is afast operation, as Delphi automatically adds the declaration of a new method to handle theevent in the class and provides you with the skeleton of the method in the implementationportion of the unit.This is part of Delphi s support for visual programming.Newer versions of Delphi also simplify life in a similar way for programmers who write alittle extra code behind event handlers.The new code-generation feature, in fact, applies togeneral methods, message-handling methods, and properties.For example, if you type thefollowing code in the class declaration:publicprocedure Hello (MessageText: string);and then press Ctrl+Shift+C, Delphi will provide you with the definition of the method inthe implementation section of the unit, generating the following lines of code:{ TForm1 }procedure TForm1.Hello(MessageText: string);beginend;This is really handy, compared with the traditional approach of many Delphi program-mers, which is to copy and paste one or more declarations, add the class names, and finallyduplicate the begin.end code for every method copied.Class completion can also work the other way around.You can write the implementationof the method with its code directly, and then press Ctrl+Shift+C to generate the requiredentry in the class declaration.Code InsightBesides the Code Explorer, class completion, and the navigational features, the Delphi editorsupports the code insight technology.Collectively, the code insight techniques are based on aconstant background parsing, both of the source code you write and of the source code of thesystem units your source code refers to.Code insight comprises five capabilities: code completion, code templates, code parameters,Tooltip expression evaluation, and Tooltip symbol insight.This last feature was already cov-ered in the section Browsing in the Editor ; the other four will be discussed in the followingsubsections.You can enable, disable, and configure each of these features in the Code Insightpage of the Editor Options dialog box.Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c01.qxd 7/2/01 2:40 PM Page 19The AppBrowser Editor 19Code CompletionCode completion allows you to choose the property or method of an object simply by look-ing it up on a list or by typing its initial letters.To activate this list, you just type the name ofan object, such as Button1, then add the dot, and wait.To force the display of the list, pressCtrl+spacebar; to remove it when you don t want it, press Esc.Code completion also lets youlook for a proper value in an assignment statement.In Delphi 6, as you start typing, the list filters its content according to the initial portion ofthe element you ve inserted.The code completion list uses colors and shows more details tohelp you distinguish different items.Another new feature is that in the case of functions withparameters, parentheses are included in the generated code, and the parameters list hint isdisplayed immediately [ Pobierz caÅ‚ość w formacie PDF ]