ebook img

Delphi 5 developer's guide PDF

1113 Pages·2000·14.4 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Delphi 5 developer's guide

Developer’s Guide Borland® Delphi™ 7 for Windows™ Borland Software Corporation 100 Enterprise Way, Scotts Valley, CA 95066-3249 www.borland.com Refer to the DEPLOY document located in the root directory of your Delphi 7 product for a complete list of files that you can distribute in accordance with the Delphi 7 License Statement and Limited Warranty. Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this document. Please refer to the product CD or the About dialog box for the list of applicable patents. The furnishing of this document does not give you any license to these patents. COPYRIGHT © 1983–2002 Borland Software Corporation. All rights reserved. AllBorland brand and product names are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries. All other marks are the property of their respective owners. Printed in the U.S.A. HDE1370WW21001 7E5R0802 0203040506-987654321 D3 Contents Chapter 1 Using object variables . . . . . . . . . . . . . . 4-7 Introduction 1-1 Creating, instantiating, and destroying objects . . . . . . . . . . . . . . . . . . . . . . 4-8 What’s in this manual? . . . . . . . . . . . . . . 1-1 Components and ownership. . . . . . . . . 4-9 Manual conventions. . . . . . . . . . . . . . . . 1-2 Defining new classes . . . . . . . . . . . . . . . 4-9 Developer support services. . . . . . . . . . . . 1-3 Using interfaces. . . . . . . . . . . . . . . . . . 4-12 Part I Using interfaces across the hierarchy . . . . 4-13 Programming with Delphi Using interfaces with procedures . . . . . . 4-14 Implementing IInterface . . . . . . . . . . . 4-14 TInterfacedObject . . . . . . . . . . . . . . . 4-15 Chapter 2 Using the as operator with interfaces . . . . 4-16 Developing applications with Delphi 2-1 Reusing code and delegation. . . . . . . . . 4-16 Integrated development environment. . . . . . 2-1 Using implements for delegation . . . . 4-17 Designing applications . . . . . . . . . . . . . . 2-2 Aggregation . . . . . . . . . . . . . . . . 4-18 Creating projects. . . . . . . . . . . . . . . . . . 2-3 Memory management of interface Editing code . . . . . . . . . . . . . . . . . . . . 2-4 objects. . . . . . . . . . . . . . . . . . . . . 4-18 Compiling applications . . . . . . . . . . . . . . 2-4 Using reference counting . . . . . . . . 4-19 Debugging applications. . . . . . . . . . . . . . 2-5 Not using reference counting . . . . . . 4-20 Deploying applications . . . . . . . . . . . . . . 2-5 Using interfaces in distributed applications . . . . . . . . . . . . . . . . . 4-21 Chapter 3 Using the component library 3-1 Chapter 5 Using BaseCLX 5-1 Understanding the component library . . . . . 3-1 Properties, methods, and events . . . . . . . 3-3 Using streams . . . . . . . . . . . . . . . . . . . 5-2 Properties . . . . . . . . . . . . . . . . . . 3-3 Using streams to read or write data. . . . . 5-2 Methods . . . . . . . . . . . . . . . . . . 3-4 Stream methods for reading Events . . . . . . . . . . . . . . . . . . . . 3-4 and writing . . . . . . . . . . . . . . . 5-2 User events . . . . . . . . . . . . . . . . . 3-4 Reading and writing components . . . 5-3 System events . . . . . . . . . . . . . . . 3-4 Reading and writing strings . . . . . . . 5-3 Internal events . . . . . . . . . . . . . . . 3-4 Copying data from one stream Objects, components, and controls. . . . . . . . 3-5 to another. . . . . . . . . . . . . . . . . . . 5-4 TObject branch . . . . . . . . . . . . . . . . . 3-6 Specifying the stream position and size. . . 5-4 TPersistent branch . . . . . . . . . . . . . . . 3-7 Seeking to a specific position . . . . . . 5-4 TComponent branch. . . . . . . . . . . . . . 3-7 Using Position and Size properties . . . 5-5 TControl branch . . . . . . . . . . . . . . . . 3-9 Working with files . . . . . . . . . . . . . . . . 5-5 TWinControl/TWidgetControl branch . . .3-10 Approaches to file I/O . . . . . . . . . . . . 5-6 Using file streams . . . . . . . . . . . . . . . 5-6 Chapter 4 Creating and opening files using Using the object model 4-1 file streams . . . . . . . . . . . . . . . 5-7 What is an object? . . . . . . . . . . . . . . . . . 4-1 Using the file handle . . . . . . . . . . . 5-8 Examining a Delphi object . . . . . . . . . . 4-2 Manipulating files. . . . . . . . . . . . . . . 5-8 Changing the name of a component . . . . . 4-4 Deleting a file . . . . . . . . . . . . . . . 5-8 Inheriting data and code from an object. . . . . 4-5 Finding a file . . . . . . . . . . . . . . . 5-8 Scope and qualifiers . . . . . . . . . . . . . . . . 4-5 Renaming a file . . . . . . . . . . . . . . 5-10 Private, protected, public, and published File date-time routines . . . . . . . . . . 5-10 declarations . . . . . . . . . . . . . . . . . . 4-6 Copying a file . . . . . . . . . . . . . . . 5-11 iii Working with ini files and the system Creating a simple conversion family Registry . . . . . . . . . . . . . . . . . . . . . 5-11 andaddingunits. . . . . . . . . . . . . . . 5-34 Using TIniFile and TMemIniFile . . . . 5-12 Declare variables . . . . . . . . . . . . . 5-35 Using TRegistryIniFile . . . . . . . . . 5-13 Register the conversion family . . . . . 5-35 Using TRegistry . . . . . . . . . . . . . 5-13 Register measurement units . . . . . . . 5-35 Working with lists . . . . . . . . . . . . . . . . 5-14 Use the new units . . . . . . . . . . . . . 5-35 Common list operations. . . . . . . . . . . 5-15 Using a conversion function . . . . . . . . . 5-36 Adding list items . . . . . . . . . . . . 5-15 Declare variables . . . . . . . . . . . . . 5-36 Deleting list items . . . . . . . . . . . . 5-15 Register the conversion family . . . . . 5-36 Accessing list items . . . . . . . . . . . 5-16 Register the base unit . . . . . . . . . . 5-36 Rearranging list items . . . . . . . . . . 5-16 Write methods to convert to and Persistent lists. . . . . . . . . . . . . . . . . 5-16 fromthebaseunit . . . . . . . . . . . . 5-36 Working with string lists . . . . . . . . . . . . 5-17 Register the other units . . . . . . . . . 5-37 Loading and saving string lists . . . . . . . 5-17 Use the new units . . . . . . . . . . . . . 5-37 Creating a new string list . . . . . . . . . . 5-18 Using a class to manage conversions . . . . 5-37 Short-term string lists . . . . . . . . . . 5-18 Creating the conversion class . . . . . . 5-38 Long-term string lists . . . . . . . . . . 5-18 Declare variables . . . . . . . . . . . . . 5-39 Manipulating strings in a list . . . . . . . . 5-20 Register the conversion family and Counting the strings in a list . . . . . . 5-20 theotherunits . . . . . . . . . . . . . . 5-39 Accessing a particular string . . . . . . 5-20 Use the new units . . . . . . . . . . . . . 5-40 Locating items in a string list . . . . . . 5-20 Defining custom variants . . . . . . . . . . . . 5-40 Iterating through strings in a list . . . . 5-20 Storing a custom variant type’s data . . . . 5-41 Adding a string to a list . . . . . . . . . 5-21 Creating a class to enable the Moving a string within a list . . . . . . 5-21 customvarianttype . . . . . . . . . . . . . 5-42 Deleting a string from a list . . . . . . . 5-21 Enabling casting . . . . . . . . . . . . . 5-42 Associating objects with a Implementing binary operations . . . . 5-44 string list . . . . . . . . . . . . . . . . 5-22 Implementing comparison Working with strings . . . . . . . . . . . . . . 5-22 operations . . . . . . . . . . . . . . . . 5-46 Wide character routines . . . . . . . . . . . 5-22 Implementing unary operations . . . . 5-47 Commonly used long string routines . . . 5-23 Copying and clearing custom variants . . . 5-48 Commonly used routines for Loading and saving custom null-terminatedstrings. . . . . . . . . . . 5-26 variant values . . . . . . . . . . . . . . 5-49 Declaring and initializing strings. . . . . . 5-27 Using the TCustomVariantType Mixing and converting string types . . . . 5-28 descendant . . . . . . . . . . . . . . . . 5-50 String to PChar conversions. . . . . . . . . 5-28 Writing utilities to work with a String dependencies . . . . . . . . . . . 5-29 customvarianttype . . . . . . . . . . . . . 5-50 Returning a PChar local variable . . . 5-29 Supporting properties and methods Passing a local variable as incustomvariants. . . . . . . . . . . . . . 5-51 a PChar . . . . . . . . . . . . . . . . . 5-29 Using TInvokeableVariantType . . . . . 5-51 Compiler directives for strings . . . . . . . 5-30 Using TPublishableVariantType . . . . 5-53 Creating drawing spaces . . . . . . . . . . . . 5-31 Chapter 6 Printing . . . . . . . . . . . . . . . . . . . . . . 5-32 Converting measurements . . . . . . . . . . . 5-33 Working with components 6-1 Performing conversions . . . . . . . . . . . 5-33 Setting component properties . . . . . . . . . . 6-2 Performing simple conversions . . . . 5-33 Setting properties at design time . . . . . . 6-2 Performing complex conversions . . . 5-33 Using property editors . . . . . . . . . . 6-3 Adding new measurement types. . . . . . 5-34 Setting properties at runtime. . . . . . . . . 6-3 Calling methods. . . . . . . . . . . . . . . . . . 6-3 iv Working with events and event handlers . . . . 6-3 Adding graphics to controls. . . . . . . . . . . 7-13 Generating a new event handler . . . . . . . 6-4 Indicating that a control is Generating a handler for a owner-drawn. . . . . . . . . . . . . . . . . 7-13 component’sdefaultevent . . . . . . . . . 6-4 Adding graphical objects to Locating event handlers . . . . . . . . . . . . 6-4 a string list . . . . . . . . . . . . . . . . . . 7-14 Associating an event with an existing Adding images to an application . . . . 7-14 eventhandler . . . . . . . . . . . . . . . . . 6-5 Adding images to a string list . . . . . . 7-14 Using the Sender parameter . . . . . . . 6-5 Drawing owner-drawn items . . . . . . 7-15 Displaying and coding shared Sizing owner-draw items. . . . . . . . . . . 7-16 events . . . . . . . . . . . . . . . . . . . 6-5 Drawing owner-draw items . . . . . . . . . 7-17 Associating menu events with Chapter 8 event handlers . . . . . . . . . . . . . . . . 6-6 Deleting event handlers . . . . . . . . . . . . 6-6 Building applications, components, Cross-platform and non-cross-platform and libraries 8-1 components. . . . . . . . . . . . . . . . . . . . 6-7 Creating applications. . . . . . . . . . . . . . . 8-1 Adding custom components to the GUI applications. . . . . . . . . . . . . . . . 8-2 Componentpalette. . . . . . . . . . . . . . 6-9 User interface models . . . . . . . . . . 8-2 Chapter 7 SDI applications . . . . . . . . . . . . . 8-2 MDI applications . . . . . . . . . . . . . 8-2 Working with controls 7-1 Setting IDE, project, and compiler Implementing drag and drop in controls . . . . 7-1 options . . . . . . . . . . . . . . . . . . 8-3 Starting a drag operation . . . . . . . . . . . 7-1 Programming templates . . . . . . . . . . . 8-3 Accepting dragged items . . . . . . . . . . . 7-2 Console applications . . . . . . . . . . . . . 8-4 Dropping items. . . . . . . . . . . . . . . . . 7-3 Service applications. . . . . . . . . . . . . . 8-5 Ending a drag operation. . . . . . . . . . . . 7-3 Service threads . . . . . . . . . . . . . . 8-8 Customizing drag and drop with Service name properties . . . . . . . . . 8-9 a drag object. . . . . . . . . . . . . . . . . . 7-3 Debugging service applications . . . . . 8-10 Changing the drag mouse pointer . . . . . . 7-4 Creating packages and DLLs . . . . . . . . . . 8-11 Implementing drag and dock in controls . . . . 7-4 When to use packages and DLLs . . . . . . 8-11 Making a windowed control a Writing database applications. . . . . . . . . . 8-12 docking site . . . . . . . . . . . . . . . . . . 7-4 Distributing database applications . . . . . 8-13 Making a control a dockable child . . . . . . 7-5 Creating Web server applications. . . . . . . . 8-13 Controlling how child controls Creating Web Broker applications. . . . . . 8-14 are docked. . . . . . . . . . . . . . . . . . . 7-5 Creating WebSnap applications . . . . . . . 8-15 Controlling how child controls Creating Web Services applications . . . . . 8-15 are undocked . . . . . . . . . . . . . . . . . 7-6 Writing applications using COM . . . . . . . . 8-16 Controlling how child controls respond Using COM and DCOM . . . . . . . . . . . 8-16 to drag-and-dockoperations . . . . . . . . 7-6 Using MTS and COM+ . . . . . . . . . . . . 8-16 Working with text in controls. . . . . . . . . . . 7-6 Using data modules . . . . . . . . . . . . . . . 8-17 Setting text alignment . . . . . . . . . . . . . 7-7 Creating and editing standard data Adding scroll bars at runtime. . . . . . . . . 7-7 modules. . . . . . . . . . . . . . . . . . . . 8-17 Adding the clipboard object. . . . . . . . . . 7-8 Naming a data module and Selecting text . . . . . . . . . . . . . . . . . . 7-9 its unit file . . . . . . . . . . . . . . . . 8-18 Selecting all text . . . . . . . . . . . . . . . . 7-9 Placing and naming components . . . . 8-19 Cutting, copying, and pasting text . . . . . 7-10 Using component properties and Deleting selected text . . . . . . . . . . . . 7-10 eventsinadatamodule . . . . . . . . 8-19 Disabling menu items . . . . . . . . . . . . 7-11 Creating business rules in a Providing a pop-up menu. . . . . . . . . . 7-11 data module . . . . . . . . . . . . . . . 8-20 Handling the OnPopup event. . . . . . . . 7-12 v Accessing a data module from a form . . . 8-20 Chapter 9 Adding a remote data module to an Developing the application applicationserver project . . . . . . . . . 8-21 userinterface 9-1 Using the Object Repository . . . . . . . . . . 8-21 Sharing items within a project . . . . . . . 8-21 Controlling application behavior . . . . . . . . 9-1 Adding items to the Object Working at the application level. . . . . . . 9-2 Repository. . . . . . . . . . . . . . . . . . 8-22 Handling the screen. . . . . . . . . . . . . . 9-2 Sharing objects in a team Setting up forms. . . . . . . . . . . . . . . . . . 9-3 environment. . . . . . . . . . . . . . . . . 8-22 Using the main form . . . . . . . . . . . . . 9-3 Using an Object Repository item in Hiding the main form. . . . . . . . . . . . . 9-3 a project . . . . . . . . . . . . . . . . . . . 8-22 Adding forms . . . . . . . . . . . . . . . . . 9-4 Copying an item . . . . . . . . . . . . . 8-22 Linking forms . . . . . . . . . . . . . . . 9-4 Inheriting an item . . . . . . . . . . . . 8-23 Avoiding circular unit references . . . . 9-4 Using an item . . . . . . . . . . . . . . 8-23 Managing layout . . . . . . . . . . . . . . . 9-5 Using project templates . . . . . . . . . . . 8-23 Using forms . . . . . . . . . . . . . . . . . . . . 9-6 Modifying shared items . . . . . . . . . . . 8-23 Controlling when forms reside Specifying a default project, new form, in memory . . . . . . . . . . . . . . . . . . 9-6 andmainform . . . . . . . . . . . . . . . 8-24 Displaying an auto-created form . . . . 9-6 Enabling Help in applications . . . . . . . . . 8-24 Creating forms dynamically . . . . . . . 9-7 Help system interfaces. . . . . . . . . . . . 8-25 Creating modeless forms such Implementing ICustomHelpViewer . . . . 8-25 as windows . . . . . . . . . . . . . . . 9-8 Communicating with the Help Creating a form instance using Manager . . . . . . . . . . . . . . . . . . . 8-26 a local variable . . . . . . . . . . . . . 9-8 Asking the Help Manager for Passing additional arguments to forms. . . 9-8 information . . . . . . . . . . . . . . . . . 8-26 Retrieving data from forms. . . . . . . . . . 9-9 Displaying keyword-based Help. . . . . . 8-27 Retrieving data from modeless Displaying tables of contents . . . . . . . . 8-28 forms . . . . . . . . . . . . . . . . . . . 9-9 Implementing IExtendedHelpViewer . . . 8-28 Retrieving data from modal forms . . . 9-11 Implementing IHelpSelector . . . . . . . . 8-29 Reusing components and groups of Registering Help system objects . . . . . . 8-30 components . . . . . . . . . . . . . . . . . . . 9-13 Registering Help viewers . . . . . . . . 8-30 Creating and using component Registering Help selectors . . . . . . . 8-30 templates. . . . . . . . . . . . . . . . . . . . . 9-13 Using Help in a VCL application. . . . . . . . 8-31 Working with frames. . . . . . . . . . . . . . . 9-14 How TApplication processes Creating frames . . . . . . . . . . . . . . . . 9-14 VCL Help . . . . . . . . . . . . . . . . . . 8-31 Adding frames to the Component How VCL controls process Help . . . . . . 8-31 palette. . . . . . . . . . . . . . . . . . . . . 9-15 Using Help in a CLX application. . . . . . . . 8-32 Using and modifying frames. . . . . . . . . 9-15 How TApplication processes Sharing frames. . . . . . . . . . . . . . . . . 9-16 CLX Help . . . . . . . . . . . . . . . . . . 8-32 Developing dialog boxes. . . . . . . . . . . . . 9-17 How CLX controls process Help . . . . . . 8-32 Using open dialog boxes . . . . . . . . . . . 9-17 Calling a Help system directly . . . . . . . . . 8-33 Organizing actions for toolbars Using IHelpSystem . . . . . . . . . . . . . . . 8-33 and menus . . . . . . . . . . . . . . . . . . . . 9-18 Customizing the IDE Help system. . . . . . . 8-34 What is an action?. . . . . . . . . . . . . . . 9-19 Setting up action bands. . . . . . . . . . . . 9-20 vi Creating toolbars and menus . . . . . . . . 9-20 Manipulating menu items at runtime. . . . 9-44 Adding color, patterns, or pictures Merging menus . . . . . . . . . . . . . . . . 9-44 tomenus,buttons,and toolbars . . . 9-22 Specifying the active menu: Menu Adding icons to menus and property . . . . . . . . . . . . . . . . . 9-45 toolbars . . . . . . . . . . . . . . . . . 9-22 Determining the order of merged menu Selecting menu and toolbar styles . . . 9-23 items: GroupIndex property . . . . . . 9-45 Creating dynamic menus . . . . . . . . 9-24 Importing resource files . . . . . . . . . . . 9-45 Creating toolbars and menus that Designing toolbars and cool bars . . . . . . . . 9-46 userscancustomize . . . . . . . . . . 9-24 Adding a toolbar using a panel Hiding unused items and categories component . . . . . . . . . . . . . . . . . . 9-47 inactionbands . . . . . . . . . . . . . 9-24 Adding a speed button to a panel . . . 9-47 Creating most recently used Assigning a speed button’s glyph . . . 9-48 (MRU) lists . . . . . . . . . . . . . . . 9-25 Setting the initial condition of a Using action lists. . . . . . . . . . . . . . . . . 9-26 speed button . . . . . . . . . . . . . . . 9-48 Setting up action lists . . . . . . . . . . . . 9-26 Creating a group of speed buttons . . . 9-48 What happens when an action fires . . . . 9-27 Allowing toggle buttons . . . . . . . . . 9-49 Responding with events . . . . . . . . 9-27 Adding a toolbar using the toolbar How actions find their targets . . . . . 9-29 component . . . . . . . . . . . . . . . . . . 9-49 Updating actions . . . . . . . . . . . . . . . 9-29 Adding a tool button . . . . . . . . . . . 9-49 Predefined action classes . . . . . . . . . . 9-30 Assigning images to tool buttons . . . . 9-50 Writing action components . . . . . . . . . 9-31 Setting tool button appearance and Registering actions. . . . . . . . . . . . . . 9-31 initialconditions . . . . . . . . . . . . 9-50 Creating and managing menus. . . . . . . . . 9-32 Creating groups of tool buttons . . . . . 9-51 Opening the Menu Designer . . . . . . . . 9-33 Allowing toggled tool buttons . . . . . 9-51 Building menus. . . . . . . . . . . . . . . . 9-34 Adding a cool bar component . . . . . . . . 9-51 Naming menus . . . . . . . . . . . . . 9-34 Setting the appearance of the Naming the menu items . . . . . . . . 9-34 cool bar . . . . . . . . . . . . . . . . . . 9-52 Adding, inserting, and deleting Responding to clicks . . . . . . . . . . . . . 9-52 menu items . . . . . . . . . . . . . . . 9-35 Assigning a menu to a tool button . . . 9-52 Adding separator bars . . . . . . . . . 9-36 Adding hidden toolbars . . . . . . . . . . . 9-53 Specifying accelerator keys and Hiding and showing toolbars . . . . . . . . 9-53 keyboardshortcuts . . . . . . . . . . 9-36 Demo programs . . . . . . . . . . . . . . . . 9-53 Creating submenus. . . . . . . . . . . . . . 9-37 Common controls and XP themes. . . . . . . . 9-54 Creating submenus by demoting Chapter 10 existingmenus . . . . . . . . . . . . . 9-37 Moving menu items . . . . . . . . . . . 9-38 Types of controls 10-1 Adding images to menu items . . . . . 9-38 Text controls. . . . . . . . . . . . . . . . . . . . 10-1 Viewing the menu . . . . . . . . . . . . 9-39 Edit controls . . . . . . . . . . . . . . . . . . 10-1 Editing menu items in the Object Memo and rich edit controls . . . . . . 10-2 Inspector. . . . . . . . . . . . . . . . . . . 9-39 Text viewing controls . . . . . . . . . . . . . 10-3 Using the Menu Designer context Labels. . . . . . . . . . . . . . . . . . . . . . 10-3 menu. . . . . . . . . . . . . . . . . . . . . 9-40 Specialized input controls . . . . . . . . . . . . 10-4 Commands on the context menu . . . 9-40 Scroll bars . . . . . . . . . . . . . . . . . . . 10-4 Switching between menus at Track bars. . . . . . . . . . . . . . . . . . . . 10-5 design time . . . . . . . . . . . . . . . 9-41 Up-down controls. . . . . . . . . . . . . . . 10-5 Using menu templates. . . . . . . . . . . . 9-41 Spin edit controls (CLX only) . . . . . . . . 10-5 Saving a menu as a template . . . . . . . . 9-43 Hot key controls (VCL only) . . . . . . . . . 10-6 Naming conventions for template Splitter controls . . . . . . . . . . . . . . . . 10-6 menu itemsandevent handlers . . . 9-44 vii Buttons and similar controls . . . . . . . . . . 10-6 Using ModelMaker views . . . . . . . . . . . . 11-4 Button controls . . . . . . . . . . . . . . . . 10-7 Collections pane. . . . . . . . . . . . . . . . 11-5 Bitmap buttons . . . . . . . . . . . . . . . . 10-7 Classes view . . . . . . . . . . . . . . . . 11-5 Speed buttons. . . . . . . . . . . . . . . . . 10-8 Units view . . . . . . . . . . . . . . . . . 11-5 Check boxes. . . . . . . . . . . . . . . . . . 10-8 Diagrams view . . . . . . . . . . . . . . 11-6 Radio buttons. . . . . . . . . . . . . . . . . 10-8 Members pane. . . . . . . . . . . . . . . . . 11-7 Toolbars . . . . . . . . . . . . . . . . . . . . 10-9 Editors pane . . . . . . . . . . . . . . . . . . 11-7 Cool bars (VCL only). . . . . . . . . . . . . 10-9 Implementation Editor . . . . . . . . . . 11-7 List controls. . . . . . . . . . . . . . . . . . . . 10-9 Unit Code Editor . . . . . . . . . . . . . 11-8 List boxes and check-list boxes . . . . . . . 10-10 Diagram Editor . . . . . . . . . . . . . . 11-9 Combo boxes . . . . . . . . . . . . . . . . . 10-11 Other Editors . . . . . . . . . . . . . . . 11-9 Tree views. . . . . . . . . . . . . . . . . . . 10-11 For more information. . . . . . . . . . . . . . 11-10 List views . . . . . . . . . . . . . . . . . . . 10-12 Chapter 12 Icon views (CLX only) . . . . . . . . . . . . 10-12 Date-time pickers and month Working with graphics and calendars. . . . . . . . . . . . . . . . . . . 10-12 multimedia 12-1 Grouping controls . . . . . . . . . . . . . . . . 10-12 Overview of graphics programming . . . . . . 12-1 Group boxes and radio groups . . . . . . . 10-13 Refreshing the screen . . . . . . . . . . . . . 12-2 Panels . . . . . . . . . . . . . . . . . . . . . 10-13 Types of graphic objects . . . . . . . . . . . 12-3 Scroll boxes . . . . . . . . . . . . . . . . . . 10-13 Common properties and methods Tab controls . . . . . . . . . . . . . . . . . . 10-14 of Canvas. . . . . . . . . . . . . . . . . . . 12-4 Page controls . . . . . . . . . . . . . . . . . 10-14 Using the properties of the Canvas Header controls. . . . . . . . . . . . . . . . 10-14 object . . . . . . . . . . . . . . . . . . . . . 12-5 Display controls . . . . . . . . . . . . . . . . . 10-15 Using pens . . . . . . . . . . . . . . . . 12-5 Status bars. . . . . . . . . . . . . . . . . . . 10-15 Using brushes . . . . . . . . . . . . . . . 12-8 Progress bars . . . . . . . . . . . . . . . . . 10-15 Reading and setting pixels . . . . . . . 12-9 Help and hint properties . . . . . . . . . . 10-16 Using Canvas methods to draw Grids. . . . . . . . . . . . . . . . . . . . . . . . 10-16 graphic objects. . . . . . . . . . . . . . . 12-10 Draw grids . . . . . . . . . . . . . . . . . . 10-16 Drawing lines and polylines . . . . . 12-10 String grids . . . . . . . . . . . . . . . . . . 10-16 Drawing shapes . . . . . . . . . . . . . 12-11 Value list editors (VCL only) . . . . . . . . . . 10-17 Handling multiple drawing objects Graphic controls . . . . . . . . . . . . . . . . . 10-18 inyourapplication . . . . . . . . . . . . 12-12 Images. . . . . . . . . . . . . . . . . . . . . 10-18 Keeping track of which drawing Shapes . . . . . . . . . . . . . . . . . . . . . 10-18 tool to use . . . . . . . . . . . . . . . 12-12 Bevels . . . . . . . . . . . . . . . . . . . . . 10-18 Changing the tool with speed Paint boxes . . . . . . . . . . . . . . . . . . 10-19 buttons . . . . . . . . . . . . . . . . . 12-13 Animation control . . . . . . . . . . . . . . 10-19 Using drawing tools . . . . . . . . . . 12-14 Chapter 11 Drawing on a graphic. . . . . . . . . . . . 12-16 Making scrollable graphics . . . . . . 12-17 Designing classes and Adding an image control . . . . . . . 12-17 components with ModelMaker 11-1 Loading and saving graphics files. . . . . 12-19 ModelMaker fundamentals. . . . . . . . . . . 11-2 Loading a picture from a file . . . . . 12-19 ModelMaker models. . . . . . . . . . . . . 11-2 Saving a picture to a file . . . . . . . . 12-20 Using ModelMaker with the IDE. . . . . . 11-2 Replacing the picture . . . . . . . . . . 12-20 Creating models . . . . . . . . . . . . . . . 11-3 viii Using the clipboard with graphics . . . . . 12-21 Executing thread objects . . . . . . . . . . . . 13-12 Copying graphics to the Overriding the default priority . . . . . . 13-12 clipboard . . . . . . . . . . . . . . . . 12-22 Starting and stopping threads . . . . . . . 13-12 Cutting graphics to the clipboard . . . 12-22 Debugging multi-threaded applications . . . 13-13 Pasting graphics from the Naming a thread. . . . . . . . . . . . . . . 13-13 clipboard . . . . . . . . . . . . . . . . 12-23 Converting an unnamed thread Rubber banding example . . . . . . . . . . 12-24 toanamedthread . . . . . . . . . . 13-13 Responding to the mouse . . . . . . . . 12-24 Assigning separate names to Responding to a mouse-down similar threads . . . . . . . . . . . . 13-15 action . . . . . . . . . . . . . . . . . . 12-25 Chapter 14 Adding a field to a form object to trackmouseactions . . . . . . . . . . 12-27 Exception handling 14-1 Refining line drawing . . . . . . . . . . 12-28 Defining protected blocks . . . . . . . . . . . . 14-2 Working with multimedia . . . . . . . . . . . 12-30 Writing the try block . . . . . . . . . . . . . 14-2 Adding silent video clips to an Raising an exception . . . . . . . . . . . 14-3 application. . . . . . . . . . . . . . . . . . 12-30 Writing exception handlers. . . . . . . . . . 14-4 Example of adding silent Exception-handling statements . . . . . 14-4 video clips . . . . . . . . . . . . . . . 12-31 Handling classes of exceptions . . . . . 14-6 Adding audio and/or video clips to Scope of exception handlers . . . . . . . 14-6 an application. . . . . . . . . . . . . . . . 12-32 Reraising exceptions . . . . . . . . . . . 14-7 Example of adding audio and/or Writing finally blocks . . . . . . . . . . . . . 14-8 video clips (VCL only) . . . . . . . . 12-33 Writing a finally block . . . . . . . . . . 14-9 Handling exceptions in VCL Chapter 13 applications . . . . . . . . . . . . . . . . . . . 14-9 Writing multi-threaded applications 13-1 VCL exception classes . . . . . . . . . . . 14-10 Defining thread objects . . . . . . . . . . . . . 13-2 Default exception handling in VCL . . . . 14-11 Initializing the thread . . . . . . . . . . . . 13-3 Silent exceptions. . . . . . . . . . . . . . . 14-12 Assigning a default priority . . . . . . 13-3 Defining your own VCL exceptions. . . . 14-13 Indicating when threads are freed . . . 13-4 Chapter 15 Writing the thread function . . . . . . . . . 13-4 Using the main VCL/CLX thread . . . 13-4 Developing cross-platform Using thread-local variables . . . . . . 13-6 applications 15-1 Checking for termination by other Creating CLX applications. . . . . . . . . . . . 15-2 threads . . . . . . . . . . . . . . . . . 13-6 Porting VCL applications . . . . . . . . . . . . 15-2 Handling exceptions in the thread Porting techniques . . . . . . . . . . . . . . 15-2 function . . . . . . . . . . . . . . . . . 13-6 Platform-specific ports . . . . . . . . . . 15-3 Writing clean-up code . . . . . . . . . . . . 13-7 Cross-platform ports . . . . . . . . . . . 15-3 Coordinating threads . . . . . . . . . . . . . . 13-7 Windows emulation ports . . . . . . . . 15-3 Avoiding simultaneous access . . . . . . . 13-7 Modifying VCL applications. . . . . . . . . 15-4 Locking objects . . . . . . . . . . . . . 13-8 WinCLX versus VisualCLX. . . . . . . . . . 15-5 Using critical sections . . . . . . . . . . 13-8 What VisualCLX does differently . . . . 15-6 Using the multi-read exclusive-write Features that do not port directly synchronizer . . . . . . . . . . . . . . 13-8 or are missing . . . . . . . . . . . . . . . . 15-7 Other techniques for sharing Comparing WinCLX and memory . . . . . . . . . . . . . . . . . 13-9 VisualCLX units . . . . . . . . . . . . . . . 15-8 Waiting for other threads . . . . . . . . . . 13-9 Differences in CLX object constructors . . 15-11 Waiting for a thread to finish Handling system and widget events . . . 15-12 executing . . . . . . . . . . . . . . . . 13-10 Waiting for a task to be completed . . . . . . . . . . . . . . . 13-10 ix Writing portable code . . . . . . . . . . . . 15-12 Editing package source files Using conditional directives . . . . . . 15-13 manually . . . . . . . . . . . . . . . . . . 16-10 Terminating conditional Compiling packages . . . . . . . . . . . . 16-10 directives . . . . . . . . . . . . . . . . 15-14 Package-specific compiler Including inline assembler code . . . . 15-15 directives . . . . . . . . . . . . . . . . 16-11 Programming differences on Linux . . . . 15-16 Compiling and linking from the Transferring applications between command line . . . . . . . . . . . . . 16-13 WindowsandLinux . . . . . . . . . . . . . . 15-17 Package files created when Sharing source files between compiling . . . . . . . . . . . . . . . 16-13 WindowsandLinux . . . . . . . . . . . . 15-17 Deploying packages . . . . . . . . . . . . . . 16-14 Environmental differences between Deploying applications that use WindowsandLinux . . . . . . . . . . . . 15-18 packages . . . . . . . . . . . . . . . . . . 16-14 Registry . . . . . . . . . . . . . . . . . . 15-20 Distributing packages to other Look and feel . . . . . . . . . . . . . . . 15-20 developers . . . . . . . . . . . . . . . . . 16-14 Directory structure on Linux . . . . . . . . 15-20 Package collection files . . . . . . . . . . . 16-14 Cross-platform database applications . . . . . 15-21 Chapter 17 dbExpress differences . . . . . . . . . . . . 15-22 Component-level differences . . . . . . . . 15-22 Creating international applications 17-1 User interface-level differences . . . . . . . 15-23 Internationalization and localization . . . . . . 17-1 Porting database applications Internationalization . . . . . . . . . . . . . . 17-1 to Linux . . . . . . . . . . . . . . . . . . . 15-24 Localization . . . . . . . . . . . . . . . . . . 17-2 Updating data in dbExpress Internationalizing applications . . . . . . . . . 17-2 applications . . . . . . . . . . . . . . . . . 15-26 Enabling application code . . . . . . . . . . 17-2 Cross-platform Internet applications . . . . . 15-28 ~Character sets . . . . . . . . . . . . . . 17-2 Porting Internet applications OEM and ANSI character sets . . . . . 17-3 to Linux . . . . . . . . . . . . . . . . . . . 15-28 Multibyte character sets . . . . . . . . . 17-3 Wide characters . . . . . . . . . . . . . . 17-4 Chapter 16 Including bi-directional functionality Working with packages and inapplications . . . . . . . . . . . . . . 17-4 components 16-1 BiDiMode property . . . . . . . . . . . . 17-4 Locale-specific features . . . . . . . . . 17-7 Why use packages? . . . . . . . . . . . . . . . 16-2 Designing the user interface . . . . . . . . . 17-7 Packages and standard DLLs . . . . . . . . 16-2 Text . . . . . . . . . . . . . . . . . . . . . 17-7 Runtime packages . . . . . . . . . . . . . . . . 16-3 Graphic images . . . . . . . . . . . . . . 17-8 Loading packages in an application . . . . 16-3 Formats and sort order . . . . . . . . . . 17-8 Loading packages with the Keyboard mappings . . . . . . . . . . . 17-8 LoadPackage function . . . . . . . . . . 16-4 Isolating resources. . . . . . . . . . . . . . . 17-8 Deciding which runtime packages Creating resource DLLs. . . . . . . . . . . . 17-9 to use. . . . . . . . . . . . . . . . . . . . . 16-4 Using resource DLLs . . . . . . . . . . . . 17-10 Custom packages. . . . . . . . . . . . . . . 16-5 Dynamic switching of resource DLLs. . . 17-11 Design-time packages . . . . . . . . . . . . . . 16-5 Localizing applications. . . . . . . . . . . . . 17-12 Installing component packages. . . . . . . 16-6 Localizing resources. . . . . . . . . . . . . 17-12 Creating and editing packages . . . . . . . . . 16-7 Creating a package. . . . . . . . . . . . . . 16-7 Editing an existing package. . . . . . . . . 16-8 Understanding the structure of a package . . . . . . . . . . . . . . . . . . 16-8 Naming packages . . . . . . . . . . . . 16-8 Requires clause . . . . . . . . . . . . . 16-9 Contains clause . . . . . . . . . . . . . 16-9 x

Description:
The Delphi 5 Developer's Guide is a complete reference showing developers what they need to know most about Delphi 5. The text begins with a tour of Delphi 5 basics, including improvements since version 1. After observing object-oriented Pascal programming, including advanced language features, the
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.