[Marco Cantù - Mastering Delphi 2006 Update]

Similar documents
A Tour of the Scripting System. Contents

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0.

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

2 TUTORIAL. Overview. VisualDSP Getting Started Guide 2-1 for SHARC DSPs

PowerPoint 2003 for Windows Version Technology Workshop: Basic PowerPoint Animation for Music Presentations

Using Eclipse Europa - A Tutorial

Designer Reference 1

The Road to CCSv4. Status Update

Part I. Integrated Development Environment. Chapter 2: The Solution Explorer, Toolbox, and Properties. Chapter 3: Options and Customizations

ECE QNX Real-time Lab

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

Table Of Contents. Table of Contents Acknowledgments...5

SETTING UP A. chapter

WORD PROCESSING FOR SALE. By Shel Silverstein

Introduction to Microsoft Word 2008

SolidWorks Intro Part 1b

CodeGear RAD Studio 2007 Reviewer s Guide

Application Development in ios 7

Introduction to Microsoft Office 2007

Arduino IDE Friday, 26 October 2018

A Step-by-step guide to creating a Professional PowerPoint Presentation

Getting Started (1.8.7) 9/2/2009

Poster-making 101 for 1 PowerPoint slide

Handout Objectives: a. b. c. d. 3. a. b. c. d. e a. b. 6. a. b. c. d. Overview:

Microsoft Excel is a spreadsheet tool capable of performing calculations, analyzing data and integrating information from different programs.

FrontPage 98 Quick Guide. Copyright 2000 Peter Pappas. edteck press All rights reserved.

Atlassian Confluence 5 Essentials

Website Management with the CMS

L E S S O N 2 Background

Tools Basics. Getting Started with Renesas Development Tools R8C/3LX Family

TECHNOEzine. Student Workbook

Lesson 2 Quick Tour and Features

SDKs - Eclipse. SENG 403, Tutorial 2

RAD Studio XE Datasheet

Developer Studio FREQUENTLY ASKED QUESTIONS

Introduction to 9.0. Introduction to 9.0. Getting Started Guide. Powering collaborative online communities.

At the shell prompt, enter idlde

Word 2010 Beginning. Technology Integration Center

Debugging in Small Basic is the process of analysing a program to detect and fix errors or improve functionality in some way.

INTViewer Tutorial Cube Tutorial

Introduction to Microsoft Word 2010

ECDL Module 6 REFERENCE MANUAL

Microsoft Excel 2007

Window Designer. Opening Screen: When you start Window Designer, you will see the Opening Screen. Here you will be choosing from 4 options:

Indispensable tips for Word users

Corel Ventura 8 Introduction

Adobe Acrobat Pro: Tips, Tricks and Timesavers

Introduction to Microsoft Word 2010

IBM Rational Rhapsody Gateway Add On. User Guide

1 Ctrl + X Cut the selected item. 2 Ctrl + C (or Ctrl + Insert) Copy the selected item. 3 Ctrl + V (or Shift + Insert) Paste the selected item

Word 2016 Advanced. North American Edition SAMPLE

Intermediate Word by Alan Weaver

Getting Started with AnyBook

The Fundamentals. Document Basics

OUTLINE DELPHI 2005 FOR.NET JUMP START

HOW TO USE THE CONTENT MANAGEMENT SYSTEM (CMS) TABLE OF CONTENTS

Install Visual Studio Community Version 2017

StudioPrompter Tutorials. Prepare before you start the Tutorials. Opening and importing text files. Using the Control Bar. Using Dual Monitors

Outline. Debugging. In Class Exercise Solution. Review If Else If. Immediate Program Errors. Function Test Example

OpenForms360 Validation User Guide Notable Solutions Inc.

Let s Make a Front Panel using FrontCAD

Code::Blocks Student Manual

EXCEL 2013 FDLRS SUNRISE

CHAPTER 1 COPYRIGHTED MATERIAL. Finding Your Way in the Inventor Interface

Mach4 CNC Controller Screen Editing Guide Version 1.0

IBM Notes Client V9.0.1 Reference Guide

Getting started with Mendeley

4) Study the section of a worksheet in the image below. What is the cell address of the cell containing the word "Qtr3"?

MULTIMEDIA TRAINING KIT INTRODUCTION TO OPENOFFICE.ORG WRITER HANDOUT

SolidWorks 2½D Parts

SlickEdit Gadgets. SlickEdit Gadgets

Code Editor. The Code Editor is made up of the following areas: Toolbar. Editable Area Output Panel Status Bar Outline. Toolbar

Supplement H.1: JBuilder X Tutorial. For Introduction to Java Programming, 5E By Y. Daniel Liang

Al Mustansiriyah University / College of Medicine. Computer Science for First Year

Supplement II.B(1): JBuilder X Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Borland Turbo C++ Feature Matrix

After you create a new project you should be able to access the below windows:

NCMail: Microsoft Outlook User s Guide

Program and Graphical User Interface Design

Impress Guide Chapter 11 Setting Up and Customizing Impress

Appendix J: Using Shortcut Keys and Shortcut Menus

Excel Select a template category in the Office.com Templates section. 5. Click the Download button.

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

USER GUIDE MADCAP FLARE Tables

NEOMIN Webmail Instructions

Visual Physics Introductory Lab [Lab 0]

-Using Excel- *The columns are marked by letters, the rows by numbers. For example, A1 designates row A, column 1.

Programming Logic - Beginning

Coding Faster: Getting More Productive with Microsoft Visual

Azon Master Class. By Ryan Stevenson Guidebook #5 WordPress Usage

EtatRequete.book Page 1 Mardi, 6. avril :01 15 Reports and Queries

Correcting Grammar as You Type. 1. Right-click the text marked with the blue, wavy underline. 2. Click the desired option on the shortcut menu.

BasicMouse BasicBoard & BasicBrowser Help

Step-by. A Very Warm Welcome to the Exciting World of Computers. Let s get Started It s easy with my Step- Instructions

Sharing the Calendar

MICROSOFT WORD 2010 Quick Reference Guide

WORD PROCESSING ASSIGNMENT # 1 ~ FILENAME: FONTS

Press the Plus + key to zoom in. Press the Minus - key to zoom out. Scroll the mouse wheel away from you to zoom in; towards you to zoom out.

Visual Physics - Introductory Lab Lab 0

Kids 'n Vue. User's Guide

Transcription:

INTRODUCTION This short ebook covers the differences between Delphi 2005 and Delphi 2006. It is meant as an update of the book Mastering Borland Delphi 2006, written by Marco Cantù and published by Sybex (now an imprint of Wiley). Although you can read it by itself, there are frequent references to the book, so you need the book at hand to fully benefit from it. In fact, I avoided repeating material already in the book. The updates in this ebook are organized by the printed book chapter they refer to. The examples discussed here are available online on www.marcocantu.com/md2005. The Author Marco Cantù is the author of the best-selling Mastering Delphi book series and a prominent figure of the Delphi community. He's also one of the recipients of the Spirit of Delphi award. Marco teaches and consults on Delphi, but also in XML-related and Web technologies. Marco's web site is on www.marcocantu.com and his blog on blog.marcocantu.com. You can reach him at marco.cantu@gmail.com. Marco lives in Italy, with his wife Lella (an interior designer), their two kids Benedetta and Jacopo, and the dog Lillo. Copyright 2005-2006 Marco Cantù All right reserved Page 1

CHAPTER 1: THE DELPHI 2006 IDE The 2006 version of Delphi has the formal name of Borland Developer Studio 2006. Borland has kept the product-specific names in this release, but is likely to stop them in the future, to underline the fact you are buying a multi-language studio IDE, and bring this in line with Microsoft's offering. In this section we are focusing on the most relevant new features of the IDE. Delphi1 2006 IDE is not as revolutionary as the previous version, as it is based on the same architecture and has a very similar look-andfeel. Borland has made a lot of effort to the the new version of the IDE much more stable, as this was the most frequent complain user had for Delphi 2005. But along with more stability and speed, Delphi 2006 IDE adds a relevant number of new features. Flexible Installation and Execution First of all, when you install Borland Developer Studio 2006 (or BDS 2006) you can pick only some of the four personalities that are available: Delphi for Win32, Delphi for.net, C++Builder for Win32, and C# (obviously for.net). Even in case you decide to install all of the personalities, you can choose which one you want to activate when you start the IDE. A set of related shortcuts are installed in the BDS 2006. Starting only a personalities result in shorter startup time, less memory usage, and a slightly faster IDE overall. Also, the IDE will be less cluttered with options you don't case for, like in the File New menu. Starting a single personality is supported by a new command line shortcut of the BDS.EXE program, -p. For example, you can invoke the Delphi for WIn32 personality with the -pdelphi option. What is not well known is that you can use the same shortcut to activate multiple personalities at once, separating them with a comma. For example, a Win32 developer might be interested in running both Delphi and C++Builder, which can be done with -pcbuilder,delphi. Copyright 2005-2006 Marco Cantù All right reserved Page 2

This new option extends the features of the -r option discussed in the section Starting the IDE with Multiple Configurations of Chapter 1 (page 6) in Mastering Borland Delphi 2005. &Differently from the -r flag, if you use -p any change in the IDE configuration saved in the registry will be available also as you start the full IDE or other personalities. This is an advantage as you don't have to apply the settings multiple times but also a drawback, as you cannot use this option to install experimental components and add-ins you don't want around in your main development environment. In such a case the -r option is still the way to go. The IDE Look-and-Feel Even if this doesn't really affect the IDE capabilities, it is interesting to notice that the IDE has been updated in the way it looks, with some rounded toolbars and tabs, as you can see here: From my point of view the most relevant changes of the IDE are those affecting my everyday work, that is the updates to the form designer and to the source code editor. The VCL Form Designer As soon as you place a new controls on a VCL form, you'll immediately see something new. The corners of the control and the central portion of each side have a small light blue circle. These mark the resize areas of the control: moving the mouse over them you can resize it (like in the past). Now if you place a second control in the form, you'll be able to see a more relevant new feature, Design Guidelines. This is a visual helper to properly align the controls on a form: Copyright 2005-2006 Marco Cantù All right reserved Page 3

Not only you can align the sides of a control with those of another one, but you can even align the text baseline, as in the example above. Controls automatically snap to the guidelines when they are close to them. They also snap when they are at a given margin to the border of the container control. Another new feature is the Form Positioner in the bottom right corner of the designer surface. There you can see, in small, the position of the form on the screen, which is relevant if the form uses absolute positioning. You can also use the Form Positioner to modify the Top and Left properties of the form visually. This tool is relevant only when you use the default embedded designer. Delphi 2006 Editor Compared to the form designer, the source code editor in Delphi 2006 has seen a higher number of new features. As soon as you open a source code file you can notice that the line numbers on the side of the source code file have changed. Instead of seeing the number of each and every line, now you see only each tenth line, with an hyphen indicating the intermediate lines (each fifth line), and a single dot for the others. The only exception is the line with the edit cursor, which has the line number displayed. Here is an example (the cursor is on line 17): Notice that the line numbers are not placed in the gutter with breakpoints and bookmarks any more, but have their separate area. On the side of the editor you can also notice some color lines. These mark the source code lines modified after the last time the file was saved (yellow line) or within the current editing session (green line). Copyright 2005-2006 Marco Cantù All right reserved Page 4

Beside these graphical elements, the most relevant changes in the editor are related to the several code writing helpers, from Block Completion to the new Live Templates, to the updated of the Code Completion technology. What is relevant to notice is that most of these new features are not activated using shortcut keys you have to learn, but show up automatically as you type, being triggered by simple keys like Enter, the Space Bar, or the Tab. Having new features embedded in Code Completion (manually triggered by Ctrl+Space, but often displayed automatically) is much better than having to invoke a specific request, like you had to do with the old Code Templates pressing Ctrl+J (a much less intuitive sequence). Block Completion The first new feature I want to cover is Block Completion. It automates the writing of the closing element of many code blocks. The most obvious example is the begin-end block. Simply type begin and press Enter to see the corresponding end show up below it (followed by a semicolon, unless the block is inside a if-then-else block). Block Completion helps you also with try blocks (adding finally and end), case (adds end), repeat (adds until), record and class (adds end). Live (Code) Templates While the Enter key triggers Block Completion, the Space and tab keys activate the new Code Templates, now called Live Templates. For example, if you type if followed by a space the statement will be completed with the then portion and a suggestion related with the test expression the user has to fill: Code Templates account for the definition of complex and partial blocks of code, which need the user intervention to complete them in one of more locations. You can move around these locations with the Tab key. For example, there are multiple templates for the try statement. One of these is called try finally (with Create/Free) and when it is triggered it generates code like this: := T.Create(Self); try Copyright 2005-2006 Marco Cantù All right reserved Page 5

finally.free; end; What is nice is that the editor enters in SyncEdit mode on the name of the variable, so that it is automatically repeated on the first line and on the line with the Free call. After typing it, you can move to the next editing location with the Tab key, to enter the name of the class you want to call Create for. When you are done, press the Tab key again and by exiting the Live Template this will invoke the add variable refactoring to add the proper variable declaration at the beginning of the code block (for a description of refactoring in the IDE see Chapter 11). First, templates configured in manual mode are invoked wit the Tab key, while automatic templates are triggered by the Space key. Second, Code Templates can be listed, picked, and edited in the new Template View (use the View Templates menu item to show it): &You can also work directly on them by editing their XML source code files available in the Objrepos\code_templates\delphi subfolder of the BDS\4.0 folder. From the IDE you can create a new Code Template with the command File New Other Other Files Code Template or from the Template View. Copyright 2005-2006 Marco Cantù All right reserved Page 6

The Live Templates can also be used in Surround mode. The idea is to place the initial and final portion of the template around the selected code. For example, you can crate a new begin-end block, comment an entire section of code, place a try-finally block around a code fragment, wrap some code in a REGION, and so on. To use a Surround template you have to select a block of code and use the entires in the Surround submenu in the editor local menu. The joint use of Block Completion, Live Code Templates, and Surround templates can really change the way you write code in Delphi. And, as I already mentioned, all of this without having to change the way you work, as many of this helpers popup automatically. Other Minor Editor Changes There are some other nice but less relevant changes: If you right click on a tab of the editor, you can use the new command Close all other pages. You middle-click (or click the mouse wheel) on a tab of the editor to close it. You can move from one method to the next one (or the previous one) using the key combination Ctrl+Alt+Down Arrow and Ctrl+Alt+Up Arrow. Ctrl+Alt+Home and Ctrl+Alt+End bring you to the first and last method. This is called Class Navigation. You can also restrict moving within the current class by activating the Class Lock, press Ctrl+Q and than L (keeping Ctrl pressed). The UML Designer The UML designer (that is, the Together designer embedded in Delphi 2006) has been extended in a very relevant way comapred to the 2005 versions. In particular, it now features bi-directional live code synchronization: you can edit the source code and see the diagram reflect the changes right away, but you can also edit the diagram to update the source code. You can add methods, properties, fields, create new classes, inherit new classes from existing ones, change the base class of an existing class, implement interfaces, and more. Together in Delphi 2006 is a full-blown tool, not a cut-down version as in the past. Copyright 2005-2006 Marco Cantù All right reserved Page 7

This is why, beside class diagrams, you can also work on many other UML diagrams: Use Case, Sequence, Collaboration, State Chart, and more. Together has its own set of refactorings (see the update to Chapter 11, later in this document), but features also support for design patterns, and code navigation. You can use Together to generate complete documentation for the project, to check the source code consistency with audits, and to extract the project metrics. All this goes well beyond what I can cover in this book update. IDE's Database Management Tools Compared to what I discussed in the corresponding section of the book on Delphi 2005 (page 37), the integrated database management tools of the Delphi 2006 IDE have been extended to support the dbexpress technology, a much better solution for developers involved with Win32 client/server applications. Here you can see an example of the information available in this window: Like for the BPD drivers, you can access metadata, perform free query, copy database data, and the like. Further information in Chapter 14, which covers the dbexpress architecture. A New Personality: C++ One of the relevant new features of Delphi 21006 (or better, of Borland Developer Studio 2005) is that the Delphi and C# languages are now complemented by the C++ language. There is a new version of the Borland compiler for this language, a new version of the VCL library for C++ (available in the past in C++Builder 6), new C++ specific libraries, CORBA support, and much more. Compared to C++Builder 6, the IDE Copyright 2005-2006 Marco Cantù All right reserved Page 8

and the libraries have been largely extended. Notice, though, the the C++ support is for Win32 only and not for the.net architecture of for other operating systems. The Debugger in Delphi 2006 The IDE has a number of new features related with the debugger, that I want to mention shortly considering that the book doesn't cover debugging at all. First of all, Borland has reintroduced the Remote Debugger for Win32 (like there was in Delphi 7 but not in Delphi 2005) which can now be used also for ASP.NET applications. Another new feature is the object data navigation capability of most debug views (including watches, inspector, and even the fly-by evaluation hint). You can also sort modules in the Module view, do cut and paste operations in the CPU View, and (the most intuitive feature of all) let the editor automatically close all of the source code files opened during a debugging section. This is one of my favorite features of the entire Delphi 2006 IDE. Copyright 2005-2006 Marco Cantù All right reserved Page 9