List of Figures

List of Figures

Chapter 1: Delphi 7 and Its IDE

Figure 1.1: A form and a data module in the Delphi 7 IDE
Figure 1.2: The Preferences page of the Environment Options dialog box
Figure 1.3: The Edit To-Do Item window can be used to modify a to-do item, an operation you can also do directly in the source code.
Figure 1.4: The multiple languages supported by the Delphi IDE can be associated with various file extensions in the Source Options page of the Editor Properties dialog box.
Figure 1.5: You can configure the Code Explorer in the Environment Options dialog box.
Figure 1.6:  The Diagram view shows relationships among components (and even allows you to set them up).
Figure 1.7:  The Print Options for the Diagram view
Figure 1.8:  The Frames1 example demon-strates the use of frames. The frame (on the left) and its instance inside a form (on the right) are kept in synch.
Figure 1.9: Delphi's multitarget Project Manager
Figure 1.10: The new Compiler Messages page of the Project Options dialog box
Figure 1.11: The Project Browser
Figure 1.12: The first page of the New Items dialog box, generally known as the Object Repository

Chapter 2: The Delphi Programming Language

Figure 2.1: The output of the CreateComps example, which creates Button components at run time
Figure 2.2: The DateProp example's form
Figure 2.3: Two forms of the FormProp example at run time
Figure 2.4: A representation of the structure of an object in memory, with a variable referring to it
Figure 2.5: A representation of the operation of assigning an object reference to another object. This is different from copying the actual content of an object to another.
Figure 2.6: The output of the NewDate program, with the name of the month and of the day depending on Windows regional settings
Figure 2.7: The output of the PolyAnimals example
Figure 2.8: The ErrorLog example and the log it produces
Figure 2.9: An example of the output of the ClassRef example

Chapter 3: The Run-Time Library

Figure 3.1: The Rounding example, demon-strated banker's rounding and arithmetic rounding
Figure 3.2: The form of the VariantComp example at design time
Figure 3.3: The ConvDemo example at run time
Figure 3.4: The output of the EuroConv unit, showing the use of Delphi's conversion engine with a custom measurement unit
Figure 3.5: An example of the output of the FilesList application
Figure 3.6: The dialog box of the SelectDirectory procedure, displayed by the FilesList application
Figure 3.7: The output of the IfSender example
Figure 3.8: The output of the ClassInfo example

Chapter 4: Core Library Classes

Figure 4.1: A graphical representation of the main groups of VCL components
Figure 4.2: The output of the RunProp example, which accesses properties by name at run time
Figure 4.3: In the ChangeOwner example, clicking the Change button moves the Button1 component to the second form.
Figure 4.4: The list of dates shown by the ListDemo example
Figure 4.5: The textual description of a form component, displayed inside itself by the FormToText example
Figure 4.6: The ZCompress example can compress a file using the ZLib library.

Chapter 5: Visual Controls

Figure 5.1: A comparison of the first three pages of the Component Palette for a CXL-based application (above) and a VCL-based application (below)
Figure 5.2: An application written with CLX can be directly recompiled under Linux with Kylix (displayed in the background).
Figure 5.3: The HtmlEdit example at run time: When you add new HTML text to the memo, you get an immediate preview.
Figure 5.4: The NameValues example uses the ValueListEditor component, which shows the name/value or key/ value pairs of a string list, also visible in a plain memo.
Figure 5.5: Delphi's Menu Designer in action
Figure 5.6: The Edit Tab Order dialog box
Figure 5.7: The InFocus example at run time
Figure 5.8: The controls of the Anchors example move and stretch automatically as the user changes the size of the form. No code is needed to move the controls, only proper use of the Anchors property.
Figure 5.9: The Split1 example's splitter component determines the minimum size for each control on the form, even those not adjacent to the splitter.
Figure 5.10: The ListBox control of the CustHint example shows a different hint, depending on which list item the mouse is over.
Figure 5.11: The owner-draw menu of the ODMenu example
Figure 5.12: Different examples of the output of a ListView compo-nent in the RefList program, obtained by changing the ViewStyle property and adding the check boxes
Figure 5.13: The DragTree example after loading the data and expanding the branches
Figure 5.14: The CustomNodes example has a tree view with node objects based on different custom classes, thanks to the OnCreateNodes-Class event.

Chapter 6: Building the User Interface

Figure 6.1: The first sheet of the PageControl of the Pages example, with its shortcut menu
Figure 6.2: The second page of the example can be used to size and position the tabs. Here you can see the tabs on the left of the page control.
Figure 6.3: The interface of the bitmap viewer in the BmpViewer example. Notice the owner-draw tabs.
Figure 6.4: The first page of the WizardUI example at design time
Figure 6.5: The RichBar example's toolbar. Notice the drop-down menu.
Figure 6.6: The StatusBar of the RichBar example displays a more detailed description than the fly-by hint.
Figure 6.7: The StylesDemo program, a Win-dows application that currently has an unusual Motif layout
Figure 6.8: The Pages example uses the current Windows XP theme, as it includes a manifest file (compare the figure with 6.1)
Figure 6.9: The ActionList component editor, with a list of predefined actions you can use
Figure 6.10:  The ActionList editor of the Actions example
Figure 6.11: The Actions example, with a detailed description of the Sender of an Action object's OnExecute event
Figure 6.12:  The MdEdit2 example at run time, while a user is rearranging the toolbars in the control bar
Figure 6.13:  The MdEdit2 example allows you to dock the toolbars (but not the menu) at the top or bottom of the form or to leave them floating.
Figure 6.14:  The DockTest example with three controls docked in the main form
Figure 6.15:  The main form of the DockPage example after a form has been docked to the page control on the left.
Figure 6.16: The three pages of the ActionManager editor dialog box
Figure 6.17:  Using the CustomizeDlg component, you can let a user customize the toolbars and the menu of an appli-cation by dragging items from the dialog box or moving them around in the action bars.
Figure 6.18:  The ActionManager disables least-recently used menu items that you can still see by selecting the menu extension command.
Figure 6.19:  The ListActions application has a toolbar hosting a static list and a virtual list.

Chapter 7: Working with Forms

Figure 7.1: The dynamic form generated by the DynaForm example is completely created at run time, with no design-time support.
Figure 7.2: Sample forms with the various border styles, created by the Borders example
Figure 7.3:  The BIcons example. By selecting the Help border icon and clicking the button, you get the help displayed in the figure.
Figure 7.4: The NoTitle example has no real caption but a fake one made with a label.
Figure 7.5: The KPreview program at design time
Figure 7.6: During a dragging operation, the MouseOne example uses a dotted line to indicate the final area of a rectangle.
Figure 7.7: The output of the ColorKeyHole, showing the effect of the new TransparentColor and AlphaBlend properties and the Animate-Window API
Figure 7.8:  The output of the Scroll1 example
Figure 7.9:  The lines to draw on the virtual surface of the form
Figure 7.10:  The Forms page of the Delphi Project Options dialog box
Figure 7.11:  The dialog box of the RefList2 example used in edit mode. Notice the ComboBoxEx graphical component in use.
Figure 7.12:  The three forms (a main form and two dialog boxes) of the DlgApply example at run time
Figure 7.13:  The Font selection dialog box with an Apply button
Figure 7.14: The main form of the Splash example, with the splash screen (this is the Splash2 version)

Chapter 8: The Architecture of Delphi Applications

Figure 8.1:  The ActivApp example shows whether the application is active and which of the application's forms is active.
Figure 8.2: The output of the Screen example with some secondary forms
Figure 8.3: The MdiDemo program uses a series of predefined Delphi actions connected to a menu and a toolbar.
Figure 8.4: The output of the MdiMulti example, with a child window that displays circles
Figure 8.5: The menu bar of the MdiMulti application changes automatically to reflect the currently selected child window, as you can see by comparing the menu bar with that of Figure 8.4.
Figure 8.6: The New Items dialog box allows you to create an inherited form.
Figure 8.7: The two forms of the VFI example at run time
Figure 8.8:  The base-class form and the two inherited forms of the PoliForm example at design time
Figure 8.9: A frame and two instances of it at design time, in the Frames2 example
Figure 8.10:   Each page of the FramePag example contains a frame, thus separating the code of this complex form into more manageable chunks.
Figure 8.11: The first page of the FrameTab example at run time. The frame inside the tab is created at run time.

Chapter 9: Writing Delphi Components

Figure 9.1: The Package Editor
Figure 9.2: The Project Options for packages
Figure 9.3: The Contains section of the Package Editor shows both the units that are included in the package and the component resource files.
Figure 9.4:  The Object Inspector can automatically expand sub-components, showing their properties, as in the case of the Timer property of the TMdClock component.
Figure 9.5:  A component referencing an external label at design time
Figure 9.6: The output of the Arrow component
Figure 9.7: The output of the Arrow component with a thick pen and a special hatch brush
Figure 9.8:  The Arrow component defines a custom property category, Arrow, as you can see in the Object Inspector. Notice that properties can be visible in multiple section, such as the Filled property in this case.
Figure 9.9:  An example of the use of the ActiveButton component
Figure 9.10:  The ListDialDemo example shows the dialog box encapsulated in the ListDial component.
Figure 9.11:  The collection editor, with the Object TreeView and the Object Inspector for the collection item
Figure 9.12: The list of sounds provides a hint for the user, who can also type in the property value or double-click to activate the editor (shown later, in Figure 9.13).
Figure 9.13:  The Sound Property Editor's form displays a list of available sounds and lets you load a file and hear the selected sound.
Figure 9.14: The custom menu items added by the component editor of the ListDialog component

Chapter 10: Libraries and Packages

Figure 10.1:  The output of the CallCpp example when you have clicked each of the buttons
Figure 10.2: The output of the CallFrst example, which calls the DLL you've built in Delphi
Figure 10.3: The Application page of the Project Options dialog box now has a Library Name section.
Figure 10.4:  If you run two copies of the UseMem program, you'll see that the global data in its DLL is not shared.
Figure 10.5:  The structure of the package hosting a form in Delphi's Package Editor
Figure 10.6: The output of the PackInfo example, with details of the packages it uses

Chapter 11: Modeling and OOP Programming (with ModelMaker)

Figure 11.1:  A class diagram in ModelMaker
Figure 11.2: A class diagram with interfaces, classes, and interface delegation
Figure 11.3: ModelMaker's Interface Wizard
Figure 11.4: A sequence diagram for an event handler of the NewDate example
Figure 11.5: The organizational possibilities of the Diagrams view
Figure 11.6: The Property Editor dialog
Figure 11.7: ModelMaker with the Implementation tab active
Figure 11.8: ModelMaker's Difference view
Figure 11.9:  The Documentation tab of a Class Symbol
Figure 11.10:  ModelMaker's Code Template Parameters dialog box

Chapter 12: From COM to COM+

Figure 12.1: An example of the GUIDs generated by the NewGuid example. Values depend on my computer and the time I run this program.
Figure 12.2:  The COM Object Wizard
Figure 12.3:  The Word document is being created and composed by the WordTest Delphi application.
Figure 12.4:  The type-library editor, showing the details of an interface
Figure 12.5:  Delphi's Type Library Import dialog box.
Figure 12.6:  The second toolbar of the OleCont example (above) is replaced by the server's toolbar (below).
Figure 12.7: The WordCont example shows how to use Automation with an embedded object.
Figure 12.8:  The WebDemo program after choosing a page that's well known by Delphi developers
Figure 12.9: The XArrow ActiveX control and its property page, hosted by the Delphi environment
Figure 12.10: The XClock control in the sample HTML page
Figure 12.11: The New Trans-actional Object dialog box, used to create a COM+ object
Figure 12.12: The newly installed COM+ component in a custom COM+ application (as shown by Microsoft's Com-ponent Services tool)
Figure 12.13:  A COM+ event with two subscriptions in the Component Services management console
Figure 12.14: The NetImport program uses a .NET object to sum numbers.

Chapter 13: Delphi's Database Architecture

Figure 13.1: A sample local table active at design time in the Delphi IDE
Figure 13.2: The XML display of a CDS file in the MyBase2 example. The table structure is defined by the program, which creates a file for the dataset on its first execution.
Figure 13.3: The data-aware controls of the DbAware example at design time in Delphi
Figure 13.4:  The output of the CustLookup example, with the DBLookupCombo-Box showing multiple fields in its drop-down list
Figure 13.5:  The Fields Editor with the Add Fields dialog box
Figure 13.6: The output of the FieldAcc example after the Center and Format buttons have been clicked
Figure 13.7: The definition of a calculated field in the Calc example
Figure 13.8: The output of the Calc example. Notice the Population Density calculated column and the ellipsis button displayed when you edit it.
Figure 13.9:  The output of the FieldLookup example, with the drop-down list inside the grid displaying values taken from another database table
Figure 13.10:  By handling the OnGetText and On-SetText events of a date field, the NullDates example displays specific output for null values.
Figure 13.11: The output of the Total program, showing the total salaries of the employees
Figure 13.12: The DrawData program displays a grid that includes the text of a memo field and the ubiqui-tous Borland fish.
Figure 13.13: The MltGrid example has a DBGrid control that allows the selection of multiple rows.
Figure 13.14:  The output of the NonAware example in Browse mode.The program manu-ally fetches the data every time the current record changes.
Figure 13.15:  In the SendToDb example, you can use a combo box to select the record you want to see.
Figure 13.16:  The CdsCalcs example demon-strates that by writing a little code, you can have the DBGrid control visually show the grouping defined in the ClientDataSet.
Figure 13.17: The bottom portion of a ClientDataSet's Fields Editor displays aggregate fields.
Figure 13.18:  The MastDet example at run time

Chapter 14: Client/Server with dbExpress

Figure 14.1: IBConsole lets you manage, from a single computer, InterBase databases hosted by multiple servers.
Figure 14.2: IBConsole can open separate windows to show you the details of each entity—in this case, a table.
Figure 14.3:  IBConsole's Interactive SQL window lets you try in advance the queries you plan to include in your Delphi programs.
Figure 14.4: The dbExpress Connection Editor with the dbExpress Drivers Settings dialog box
Figure 14.5: The CommandText Editor used by the SQLDataSet com-ponent for queries
Figure 14.6: A sample log obtained by the SQLMonitor in the DbxSingle example
Figure 14.7: The SchemaTest example allows you to see a database's tables and the columns of a given table.
Figure 14.8: Editing a query component's collection of parameters
Figure 14.9: The ParQuery example at run time
Figure 14.10: The CdsDelta program displays the status of each record of a ClientDataSet.
Figure 14.11: The CdsDelta example allows you to see the temporary update requests stored in the Delta property of the ClientDataSet.
Figure 14.12: The Reconcile Error dialog provided by Delphi in the Object Repository and used by the CdsDelta example
Figure 14.13: The form of the TranSample application at design time. The radio buttons let you set different transaction isolation levels.
Figure 14.14: The output of the IbxUpdSql example
Figure 14.15: The output of the IbxMon example, based on the IBMonitor component
Figure 14.16: The server informa-tion displayed by the IbxMon application
Figure 14.17: The editor for the GeneratorField property of the IBX datasets
Figure 14.18: A form showing companies, office locations, and people (part of the RWBlocks example)
Figure 14.19: The RWBlocks example form for class registrations
Figure 14.20: The free query form of the RWBlocks example is intended for power users.

Chapter 15: Working with ADO

Figure 15.1: Delphi's connection string editor
Figure 15.2: The first page of Microsoft's connec-tion string editor
Figure 15.3: The OpenSchema example retrieves the primary keys of the database tables.
Figure 15.4:   Setting extended properties
Figure 15.5:   ABCCompany.xls in Delphi—a small tribute to Douglas Adams
Figure 15.6: The form of the DataClone example, with two copies of a dataset (the original and a clone)

Chapter 16: Multitier DataSnap Applications

Figure 16.1: The Remote Data Module Wizard
Figure 16.2: When you activate a ClientDataSet component con-nected to a remote data module at design time, the data from the server becomes visible as usual.
Figure 16.3: The error message displayed by the ThinCli2 example when the employee ID is too large
Figure 16.4: The form of the ClientRefresh example, which automatically refreshes the active record and allows more extensive updates by clicking the buttons
Figure 16.5: The secondary form of the ThinPlus example, showing the data of a parametric query
Figure 16.6:  The ThinPlus example shows how a dataset field can either be displayed in a grid in a floating window or extracted by a ClientDataSet and displayed in a second form. You'll generally do one of the two things, not both!

Chapter 17: Writing Database Components

Figure 17.1: The data-aware ProgressBar in action in the DbProgr example
Figure 17.2: The DbTrack example's track bars let you enter data in a database table. The check box and buttons test the enabled status of the components.
Figure 17.3: The ViewGrid example demon-strates the output of the RecordView component, using Borland's sample BioLife database table.
Figure 17.4: An example of the MdDbGrid component at design time. Notice the output of the graphics and memo fields.
Figure 17.5:  The structure of each buffer of the custom dataset, along with the various local fields referring to its subportions
Figure 17.6:   The form of the StreamDSDemo example. The custom dataset has been activated, so you can already see the data at design time.
Figure 17.7: The output of the DirDemo example, which uses an unusual dataset that shows directory data
Figure 17.8:  The ObjDataSet-Demo example showcases a dataset mapped to objects using RTTI.

Chapter 18: Reporting with Rave

Figure 18.1: The Rave Designer with a simple report
Figure 18.2: The Rave Report Preview window for a report
Figure 18.3: After executing a Rave project, a user can choose the output format or rendering engine.
Figure 18.4: The RaveSingle report (generated with the help of a wizard) at design time
Figure 18.5: The Rave Designer's Data Text Editor
Figure 18.6:  The master/detail report. The Band Style Editor appears in front of it.
Figure 18.7: The bold text in the report is determined at run time by a script.

Chapter 19: Internet Programming: Sockets and Indy

Figure 19.1: The client program of the IndySock1 example
Figure 19.2: The client and server programs of the data-base socket example (IndyDbSock)
Figure 19.3:  The SendList pro-gram at design time
Figure 19.4:  The WebFind application can be used to search for a list of sites on the Google search engine.
Figure 19.5:  The output of the BrowseFast text-only browser
Figure 19.6:  The page displayed by connecting a browser to the custom HttpServ program
Figure 19.7: The output of the HtmlProd example, a simple demonstra-tion of the Page-Producer component, when the user clicks the Demo Page button
Figure 19.8:  The output of the HtmlProd example for the Print Line button
Figure 19.9:  The editor of the DataSetTable-Producer compo-nent's Columns property provides you with a preview of the final HTML table (if the data-base table is active).

Chapter 20: Web Programming with WebBroker and WebSnap

Figure 20.1: The output of the CgiDate application, as seen in a browser
Figure 20.2: A list of applications registered with the Web App Debugger is displayed when you hook to its home page.
Figure 20.3: The output corresponding to the table path of the BrokDemo example, which produces an HTML table with internal hyperlinks
Figure 20.4:  The form action of the CustQueP example produces an HTML form with a selection component dynamically updated to reflect the current status of the database.
Figure 20.5: The WebSearch program shows the result of multiple searches done on Google.
Figure 20.6: The options offered by the New Web-Snap Application dialog box include the type of server and a button that lets you select the core appli-cation components.
Figure 20.7:  The New WebSnap Page Module dialog box
Figure 20.8: The WSnap2 example features a plain script and a custom menu stored in an include file.
Figure 20.9:  The Web Surface Designer for the inout page of the WSnap2 example, at design time
Figure 20.10: The page shown by the WSnapTable example at startup includes the initial portion of a paged table.
Figure 20.11:  The formview page shown by the WSnapTable example at design time, in the Web Surface Designer (or AdapterPageProducer editor)
Figure 20.12: The WSnapMD example shows a master/detail structure and has some customized output.
Figure 20.13: Two instances of the browser operate on two different sessions of the same WebSnap application.

Chapter 21: Web Programming with IntraWeb

Figure 21.1:  The IWSimpleApp program in a browser
Figure 21.2: The controller form of a stand-alone IntraWeb application
Figure 21.3: The IWTree example features a menu, a tree view, and the dynamic creation of a memo component.
Figure 21.4:  The IWTwoForms example uses an IWGrid component, embedded text, and IWURL components.
Figure 21.5: The IWSession application has both session-specific and global counters, as you can see by running two sessions in two different browsers (or even in the same browser).
Figure 21.6:  IntraWeb's HTML Layout Editor is a full-blown visual HTML editor.
Figure 21.7: The data-aware grid of the IWScrollData example
Figure 21.8:  The main form of the IWGridDemo example uses a framed grid with hyperlinks to the secondary form.
Figure 21.9: The secondary form of the IWGridDemo example allows a user to edit the data and navigate through records.
Figure 21.10: The grid of the IWClientGrid example supports custom sorting and filtering without re-fetching the data on the web server.

Chapter 22: Using XML Technologies

Figure 22.1: The XmlEditOne example allows you to enter XML text in a memo, indicating errors as you type, and shows the result in the embedded browser.
Figure 22.2: The XmlDomTree example can open a generic XML document and show it inside a TreeView common control.
Figure 22.3: The DomCreate example can generate various types of XML documents using a DOM.
Figure 22.4:  The XML generated to describe the form of the DomCreate program. Notice (in the tree and in the memo text) that properties of class types are further expanded.
Figure 22.5: Delphi's XML Data Binding Wizard can examine the structure of a document or a schema (or another document definition) to create a set of interfaces for simplified and direct access to the DOM data.
Figure 22.6: The log produced by reading an XML document with the SAX in the Sax-Demo1 example
Figure 22.7: The XML Mapper shows the two sides of a transformation to define a mapping between them (with the rules indicated in the central portion).
Figure 22.8: The XmlMapping example uses a TransformProvider component to make a complex XML document available for editing within multiple ClientData-Set components.
Figure 22.9: The MapTable example generates an XML document from a database table using a custom transformation file.
Figure 22.10: The InetXPage-Producer editor allows you to build complex HTML forms visually, similarly to the AdapterPageProducer.
Figure 22.11: The IeFirst application sends the browser some HTML components, an XML document, and the JavaScript code to show the data in the visual components.
Figure 22.12: The result of an XSLT transformation generated (even at design time) by the XSLPageProducer component in the XslCust example
Figure 22.13: The LargeXml example in action

Chapter 23: Web Services and SOAP

Figure 23.1:  The WSDL Import Wizard in action
Figure 23.2: An example of a translation from English to German obtained by Alta-Vista's BabelFish via a web service
Figure 23.3: The description of the Convert-Service web service provided by Delphi components
Figure 23.4:  The ConvertCaller client of the Convert-Service web service shows how few German marks you used to get for so many Italian liras, before the euro changed everything.
Figure 23.5: The client program of the SoapEmployee web service example
Figure 23.6:  The HTTP log of the Web App Debugger includes the low-level SOAP request.
Figure 23.7: The FishClient example receives a binary ClientDataSet within a SOAP attachment.
Figure 23.8:  The UDDI Browser embedded in the Delphi IDE
Figure 23.9:  The UddiInquiry example features a limited UDDI browser.

Chapter 24: The Microsoft .NET Architecture from the Delphi Perspective

Figure 24.1: The HelloWorld demo as seen in ILDASM
Figure 24.2: The ILDASM output for the DestructorTest example
Figure 24.3: The ILDASM IL window for the Destroy destructor
Figure 24.4: .NET's Global Assembly Cache as see in Windows Explorer

Chapter 25: Delphi for .NET Preview: The Language and the RTL

Figure 25.1:  The NetClassInfo example shows the base classes of a given component.
Figure 25.2:  The CLRReflection example, with an assembly loaded
Figure 25.3: The aspbase.aspx example in a browser
Figure 25.4: The output of the aspui.aspx example, after typing in the edit box and clicking the button


Part I: Foundations