ebook img

Delphi 6 for Windows Developer’s Guide PDF

1108 Pages·2001·5.324 MB·english
by  Borland
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 6 for Windows Developer’s Guide

Developer’s Guide Borland® Delphi™ 6 for Windows Borland Software Corporation 100 Enterprise Way, Scotts Valley, CA 95066-3249 COPYRIGHT © 1983, 2001 Borland Software Corporation Printed in the U.S.A. Contents Chapter 1 TPersistent branch. . . . . . . . . . . . . . . 3-14 Introduction 1-1 TComponent branch . . . . . . . . . . . . . 3-15 TControl branch. . . . . . . . . . . . . . . . 3-16 What’s in this manual? . . . . . . . . . . . . . . 1-1 TWinControl/TWidgetControl branch . . . 3-17 Manual conventions. . . . . . . . . . . . . . . . 1-3 Properties common to TControl . . . . . . . 3-18 Developer support services. . . . . . . . . . . . 1-3 Action properties . . . . . . . . . . . . . 3-18 Ordering printed documentation . . . . . . . . 1-3 Position, size, and alignment Part I properties . . . . . . . . . . . . . . . . . 3-19 Programming with Delphi Display properties . . . . . . . . . . . . . 3-19 Parent properties. . . . . . . . . . . . . . 3-19 A navigation property. . . . . . . . . . . 3-19 Chapter 2 Drag-and-drop properties . . . . . . . . 3-20 Developing applications with Delphi 2-1 Drag-and-dock properties Integrated development environment. . . . . . 2-1 (VCL only) . . . . . . . . . . . . . . . . 3-20 Designing applications . . . . . . . . . . . . . . 2-2 Standard events common to TControl . . . 3-20 Developing applications . . . . . . . . . . . . . 2-3 Properties common to TWinControl and Creating projects . . . . . . . . . . . . . . . . 2-3 TWidgetControl . . . . . . . . . . . . . . . 3-21 Editing code. . . . . . . . . . . . . . . . . . . 2-4 General information properties . . . . . 3-21 Compiling applications . . . . . . . . . . . . 2-4 Border style display properties. . . . . . 3-22 Debugging applications . . . . . . . . . . . . 2-5 Navigation properties. . . . . . . . . . . 3-22 Deploying applications . . . . . . . . . . . . 2-5 Drag-and-dock properties (VCL only) . . . . . . . . . . . . . . . . 3-22 Chapter 3 Events common to TWinControl and Using the component libraries 3-1 TWidgetControl . . . . . . . . . . . . . . . 3-22 Understanding the component libraries. . . . . 3-1 Creating the application user interface . . . 3-23 Properties, methods, and events . . . . . . . 3-2 Using Delphi components . . . . . . . . . . 3-23 Properties . . . . . . . . . . . . . . . . . . 3-2 Setting component properties . . . . . . . . 3-24 Methods . . . . . . . . . . . . . . . . . . . 3-3 Using the Object Inspector . . . . . . . . 3-24 Events . . . . . . . . . . . . . . . . . . . . 3-3 Using property editors . . . . . . . . . . 3-25 User events . . . . . . . . . . . . . . . . . 3-3 Setting properties at runtime. . . . . . . 3-25 System events . . . . . . . . . . . . . . . . 3-4 Calling methods. . . . . . . . . . . . . . . . 3-25 Object Pascal and the class libraries . . . . . . . 3-4 Working with events and event Using the object model . . . . . . . . . . . . 3-4 handlers. . . . . . . . . . . . . . . . . . . . 3-25 What is an object?. . . . . . . . . . . . . . 3-5 Generating a new event handler. . . . . 3-26 Examining a Delphi object. . . . . . . . . 3-5 Generating a handler for a component’s Changing the name of a component . . . 3-7 default event . . . . . . . . . . . . . . . 3-26 Inheriting data and code from an object. . . 3-8 Locating event handlers. . . . . . . . . . 3-26 Scope and qualifiers . . . . . . . . . . . . . . 3-8 Associating an event with an existing Private, protected, public, and published event handler. . . . . . . . . . . . . . . 3-27 declarations . . . . . . . . . . . . . . . . 3-9 Associating menu events with event Using object variables . . . . . . . . . . . . .3-10 handlers. . . . . . . . . . . . . . . . . . 3-28 Creating, instantiating, and destroying Deleting event handlers. . . . . . . . . . 3-28 objects . . . . . . . . . . . . . . . . . . . . .3-11 VCL and CLX components . . . . . . . . . . . 3-28 Components and ownership . . . . . . . . .3-11 Adding custom components to the Objects, components, and controls. . . . . . . .3-12 Component palette . . . . . . . . . . . . . 3-30 TObject branch . . . . . . . . . . . . . . . . .3-14 Text controls . . . . . . . . . . . . . . . . . . 3-31 Text control properties. . . . . . . . . . . 3-31 Properties of memo and rich text Using helper objects . . . . . . . . . . . . . . . 3-46 controls. . . . . . . . . . . . . . . . . . .3-31 Working with lists. . . . . . . . . . . . . . . 3-47 Rich text controls (VCL only) . . . . . . .3-32 Working with string lists . . . . . . . . . . . 3-47 Specialized input controls. . . . . . . . . . .3-32 Loading and saving string lists. . . . . . 3-48 Scroll bars . . . . . . . . . . . . . . . . . .3-32 Creating a new string list . . . . . . . . . 3-48 Track bars . . . . . . . . . . . . . . . . . .3-33 Manipulating strings in a list. . . . . . . 3-50 Up-down controls (VCL only). . . . . . .3-33 Associating objects with a string list. . . 3-52 Spin edit controls (CLX only) . . . . . . .3-33 Windows registry and INI files . . . . . . . 3-52 Hot key controls (VCL only). . . . . . . .3-33 Using TIniFile (VCL only) . . . . . . . . 3-52 Splitter controls . . . . . . . . . . . . . . .3-34 Using TRegistry . . . . . . . . . . . . . . 3-53 Buttons and similar controls . . . . . . . . .3-34 Using TRegIniFile . . . . . . . . . . . . . 3-53 Button controls . . . . . . . . . . . . . . .3-34 Creating drawing spaces . . . . . . . . . . . 3-54 Bitmap buttons . . . . . . . . . . . . . . .3-35 Printing. . . . . . . . . . . . . . . . . . . . . 3-54 Speed buttons . . . . . . . . . . . . . . . .3-35 Using streams . . . . . . . . . . . . . . . . . 3-55 Check boxes . . . . . . . . . . . . . . . . .3-35 Chapter 4 Radio buttons . . . . . . . . . . . . . . . .3-35 Toolbars . . . . . . . . . . . . . . . . . . .3-36 Common programming tasks 4-1 Cool bars (VCL only). . . . . . . . . . . .3-36 Understanding classes . . . . . . . . . . . . . . .4-1 Handling lists. . . . . . . . . . . . . . . . . .3-36 Defining classes . . . . . . . . . . . . . . . . . . .4-2 List boxes and check-list boxes . . . . . .3-37 Handling exceptions . . . . . . . . . . . . . . . .4-4 Combo boxes . . . . . . . . . . . . . . . .3-37 Protecting blocks of code. . . . . . . . . . . .4-4 Tree views . . . . . . . . . . . . . . . . . .3-38 Responding to exceptions. . . . . . . . . .4-5 List views . . . . . . . . . . . . . . . . . .3-38 Exceptions and the flow of control. . . . .4-6 Date-time pickers and month Nesting exception responses . . . . . . . .4-6 calendars (VCL only). . . . . . . . . . .3-39 Protecting resource allocations. . . . . . . . .4-7 Grouping components. . . . . . . . . . . . .3-39 What kind of resources need Group boxes and radio groups . . . . . .3-39 protection? . . . . . . . . . . . . . . . . .4-7 Panels . . . . . . . . . . . . . . . . . . . .3-39 Creating a resource protection block. . . .4-8 Scroll boxes . . . . . . . . . . . . . . . . .3-40 Handling RTL exceptions. . . . . . . . . . . .4-9 Tab controls . . . . . . . . . . . . . . . . .3-40 What are RTL exceptions? . . . . . . . . .4-9 Page controls . . . . . . . . . . . . . . . .3-40 Creating an exception handler . . . . . . 4-10 Header controls. . . . . . . . . . . . . . .3-41 Exception handling statements. . . . . . 4-11 Providing visual feedback. . . . . . . . . . .3-41 Using the exception instance . . . . . . . 4-11 Labels and static text components . . . .3-41 Scope of exception handlers . . . . . . . 4-12 Status bars. . . . . . . . . . . . . . . . . .3-42 Providing default exception Progress bars . . . . . . . . . . . . . . . .3-42 handlers. . . . . . . . . . . . . . . . . . 4-12 Help and hint properties. . . . . . . . . .3-42 Handling classes of exceptions. . . . . . 4-13 Grids. . . . . . . . . . . . . . . . . . . . . . .3-43 Reraising the exception . . . . . . . . . . 4-13 Draw grids. . . . . . . . . . . . . . . . . .3-43 Handling component exceptions . . . . . . 4-14 String grids . . . . . . . . . . . . . . . . .3-43 Exception handling with external Value list editors (VCL only) . . . . . . . . .3-43 sources . . . . . . . . . . . . . . . . . . . . 4-15 Displaying graphics . . . . . . . . . . . . . .3-44 Silent exceptions. . . . . . . . . . . . . . . . 4-15 Images . . . . . . . . . . . . . . . . . . . .3-44 Defining your own exceptions. . . . . . . . 4-16 Shapes . . . . . . . . . . . . . . . . . . . .3-44 Declaring an exception object type. . . . 4-16 Bevels . . . . . . . . . . . . . . . . . . . .3-45 Raising an exception. . . . . . . . . . . . 4-17 Paint boxes. . . . . . . . . . . . . . . . . .3-45 Using interfaces. . . . . . . . . . . . . . . . . . 4-17 Animation control (VCL only). . . . . . .3-45 Interfaces as a language feature . . . . . . . 4-18 Developing dialog boxes . . . . . . . . . . .3-45 Implementing interfaces across Using open dialog boxes. . . . . . . . . .3-46 the hierarchy . . . . . . . . . . . . . . . 4-18 Using interfaces with procedures. . . . .4-20 Passing a local variable as a PChar . . . 4-48 Implementing IInterface. . . . . . . . . . . .4-20 Compiler directives for strings. . . . . . . . 4-49 TInterfacedObject . . . . . . . . . . . . . . .4-21 Strings and characters: related topics . . . . 4-50 Using the as operator . . . . . . . . . . . . .4-21 Working with files . . . . . . . . . . . . . . . . 4-50 Reusing code and delegation . . . . . . . . .4-22 Manipulating files. . . . . . . . . . . . . . . 4-50 Using implements for delegation . . . . .4-22 Deleting a file. . . . . . . . . . . . . . . . 4-50 Aggregation . . . . . . . . . . . . . . . . .4-23 Finding a file . . . . . . . . . . . . . . . . 4-51 Memory management of interface Renaming a file. . . . . . . . . . . . . . . 4-52 objects . . . . . . . . . . . . . . . . . . . . .4-24 File date-time routines . . . . . . . . . . 4-52 Using reference counting . . . . . . . . .4-24 Copying a file . . . . . . . . . . . . . . . 4-53 Not using reference counting . . . . . . .4-25 File types with file I/O . . . . . . . . . . . . 4-53 Using interfaces in distributed Using file streams . . . . . . . . . . . . . . . 4-54 applications (VCL only) . . . . . . . . . . .4-26 Creating and opening files . . . . . . . . 4-54 Defining custom variants . . . . . . . . . . . . .4-27 Using the file handle . . . . . . . . . . . 4-55 Storing a custom variant type’s data. . . . .4-28 Reading and writing to files . . . . . . . 4-55 Creating a class to enable the custom Reading and writing strings . . . . . . . 4-56 variant type . . . . . . . . . . . . . . . . . .4-28 Seeking a file . . . . . . . . . . . . . . . . 4-56 Enabling casting . . . . . . . . . . . . . .4-29 File position and size . . . . . . . . . . . 4-57 Implementing binary operations . . . . .4-30 Copying. . . . . . . . . . . . . . . . . . . 4-57 Implementing comparison operations . .4-32 Converting measurements. . . . . . . . . . . . 4-58 Implementing unary operations . . . . .4-34 Performing conversions . . . . . . . . . . . 4-58 Copying and clearing custom Performing simple conversions . . . . . 4-58 variants. . . . . . . . . . . . . . . . . . .4-34 Performing complex conversions . . . . 4-58 Loading and saving custom variant Adding new measurement types . . . . . . 4-59 values. . . . . . . . . . . . . . . . . . . .4-35 Creating a simple conversion family Using the TCustomVariantType and adding units. . . . . . . . . . . . . 4-59 descendant. . . . . . . . . . . . . . . . .4-36 Using a conversion function . . . . . . . 4-60 Writing utilities to work with a custom Using a class to manage variant type . . . . . . . . . . . . . . . . . .4-36 conversions . . . . . . . . . . . . . . . . 4-62 Supporting properties and methods in Defining data types. . . . . . . . . . . . . . . . 4-64 custom variants. . . . . . . . . . . . . . . .4-37 Chapter 5 Using TInvokeableVariantType . . . . . .4-37 Using TPublishableVariantType. . . . . .4-39 Building applications, components, Working with strings . . . . . . . . . . . . . . .4-39 and libraries 5-1 Character types. . . . . . . . . . . . . . . . .4-39 Creating applications. . . . . . . . . . . . . . . .5-1 String types . . . . . . . . . . . . . . . . . . .4-40 GUI applications. . . . . . . . . . . . . . . . .5-1 Short strings. . . . . . . . . . . . . . . . .4-40 User interface models . . . . . . . . . . . .5-2 Long strings . . . . . . . . . . . . . . . . .4-41 SDI applications . . . . . . . . . . . . . . .5-2 WideString. . . . . . . . . . . . . . . . . .4-41 MDI applications. . . . . . . . . . . . . . .5-2 PChar types . . . . . . . . . . . . . . . . .4-42 Setting IDE, project, and compilation OpenString . . . . . . . . . . . . . . . . .4-42 options . . . . . . . . . . . . . . . . . . .5-3 Runtime library string handling routines . .4-42 Programming templates . . . . . . . . . . . .5-3 Wide character routines . . . . . . . . . .4-43 Console applications . . . . . . . . . . . . . .5-3 Commonly used long string routines. . .4-43 Service applications. . . . . . . . . . . . . . .5-4 Declaring and initializing strings. . . . . . .4-46 Service threads. . . . . . . . . . . . . . . .5-6 Mixing and converting string types . . . . .4-47 Service name properties. . . . . . . . . . .5-7 String to PChar conversions. . . . . . . . . .4-47 Debugging services . . . . . . . . . . . . .5-8 String dependencies . . . . . . . . . . . .4-47 Creating packages and DLLs . . . . . . . . . . .5-9 Returning a PChar local variable . . . . .4-48 When to use packages and DLLs . . . . . . .5-9 Writing database applications . . . . . . . . . .5-10 Registering Help selectors . . . . . . . . 5-27 Distributing database applications. . . . . .5-11 Using Help in a VCL Application. . . . . . . . 5-28 Creating Web server applications . . . . . . . .5-11 How TApplication processes VCL Using Web Broker . . . . . . . . . . . . . . .5-11 Help. . . . . . . . . . . . . . . . . . . . . . 5-28 Creating WebSnap applications. . . . . . . .5-13 How VCL controls process Help. . . . . . . 5-28 Using InternetExpress . . . . . . . . . . . . .5-13 Using Help in a CLX Application. . . . . . . . 5-29 Creating Web Services applications . . . . .5-13 How TApplication processes CLX Writing applications using COM. . . . . . . . .5-14 Help. . . . . . . . . . . . . . . . . . . . . . 5-29 Using COM and DCOM. . . . . . . . . . . .5-14 How CLX controls process Help. . . . . . . 5-29 Using MTS and COM+ . . . . . . . . . . . .5-14 Calling a Help system directly . . . . . . . . . 5-30 Using data modules . . . . . . . . . . . . . . . .5-15 Using IHelpSystem . . . . . . . . . . . . . . . . 5-30 Creating and editing standard data Customizing the IDE Help system . . . . . . . 5-30 modules . . . . . . . . . . . . . . . . . . . .5-15 Chapter 6 Naming a data module and its unit file. . . . . . . . . . . . . . . . . . . . . .5-16 Developing the application user Placing and naming components . . . . .5-17 interface 6-1 Using component properties and Controlling application behavior . . . . . . . . .6-1 events in a data module . . . . . . . . .5-17 Using the main form . . . . . . . . . . . . . .6-1 Creating business rules in a data Adding forms . . . . . . . . . . . . . . . . . .6-2 module. . . . . . . . . . . . . . . . . . .5-18 Linking forms . . . . . . . . . . . . . . . .6-2 Accessing a data module from a form . . . .5-18 Avoiding circular unit references. . . . . .6-2 Adding a remote data module to an Hiding the main form. . . . . . . . . . . . . .6-3 application server project . . . . . . . . . .5-19 Working at the application level. . . . . . . .6-3 Using the Object Repository . . . . . . . . . . .5-19 Handling the screen. . . . . . . . . . . . . . .6-3 Sharing items within a project . . . . . . . .5-19 Managing layout . . . . . . . . . . . . . . . .6-4 Adding items to the Object Repository . . .5-19 Responding to event notification . . . . . . . . .6-5 Sharing objects in a team environment . . .5-20 Using forms . . . . . . . . . . . . . . . . . . . . .6-5 Using an Object Repository item in Controlling when forms reside in a project . . . . . . . . . . . . . . . . . . . .5-20 memory. . . . . . . . . . . . . . . . . . . . .6-6 Copying an item . . . . . . . . . . . . . .5-20 Displaying an auto-created form. . . . . .6-6 Inheriting an item. . . . . . . . . . . . . .5-20 Creating forms dynamically . . . . . . . .6-6 Using an item . . . . . . . . . . . . . . . .5-21 Creating modeless forms such as Using project templates . . . . . . . . . . . .5-21 windows . . . . . . . . . . . . . . . . . .6-7 Modifying shared items . . . . . . . . . . . .5-21 Using a local variable to create a form Specifying a default project, new form, instance . . . . . . . . . . . . . . . . . . .6-7 and main form . . . . . . . . . . . . . . . .5-21 Passing additional arguments to forms. . . .6-8 Enabling Help in applications . . . . . . . . . .5-22 Retrieving data from forms. . . . . . . . . . .6-9 Help system interfaces. . . . . . . . . . . . .5-22 Retrieving data from modeless forms . . .6-9 Implementing ICustomHelpViewer . . . . .5-23 Retrieving data from modal forms. . . . 6-10 Communicating with the Help Reusing components and groups of Manager . . . . . . . . . . . . . . . . . . . .5-23 components . . . . . . . . . . . . . . . . . . . 6-12 Asking the Help Manager for Creating and using component templates . . . 6-13 information . . . . . . . . . . . . . . . . . .5-24 Working with frames . . . . . . . . . . . . . . . 6-13 Displaying keyword-based Help. . . . . . .5-24 Creating frames . . . . . . . . . . . . . . . . 6-14 Displaying tables of contents . . . . . . . . .5-25 Adding frames to the component Implementing IExtendedHelpViewer . . . .5-26 palette. . . . . . . . . . . . . . . . . . . . . 6-14 Implementing IHelpSelector . . . . . . . . .5-26 Using and modifying frames. . . . . . . . . 6-14 Registering Help system objects . . . . . . .5-27 Sharing frames. . . . . . . . . . . . . . . . . 6-15 Registering Help viewers . . . . . . . . .5-27 Organizing actions for toolbars and Merging menus . . . . . . . . . . . . . . . . 6-40 menus . . . . . . . . . . . . . . . . . . . . . . .6-16 Specifying the active menu: Menu What is an action? . . . . . . . . . . . . . . .6-17 property. . . . . . . . . . . . . . . . . . 6-40 Setting up action bands . . . . . . . . . . . .6-18 Determining the order of merged menu Creating toolbars and menus . . . . . . . . .6-18 items: GroupIndex property . . . . . . 6-40 Adding color, patterns, or pictures to Importing resource files . . . . . . . . . . . 6-41 menus, buttons, and toolbars . . . . . .6-20 Designing toolbars and cool bars . . . . . . . . 6-41 Adding icons to menus and toolbars. . .6-21 Adding a toolbar using a panel Creating toolbars and menus that component . . . . . . . . . . . . . . . . . . 6-42 users can customize. . . . . . . . . . . .6-21 Adding a speed button to a panel . . . . 6-43 Hiding unused items and categories Assigning a speed button’s glyph . . . . 6-43 in action bands . . . . . . . . . . . . . .6-22 Setting the initial condition of a Using action lists. . . . . . . . . . . . . . . . . .6-23 speed button . . . . . . . . . . . . . . . 6-43 Setting up action lists . . . . . . . . . . . . .6-23 Creating a group of speed buttons. . . . 6-44 What happens when an action fires . . . . .6-24 Allowing toggle buttons . . . . . . . . . 6-44 Responding with events . . . . . . . . . .6-24 Adding a toolbar using the toolbar How actions find their targets. . . . . . .6-26 component . . . . . . . . . . . . . . . . . . 6-44 Updating actions . . . . . . . . . . . . . . . .6-26 Adding a tool button . . . . . . . . . . . 6-45 Predefined action classes . . . . . . . . . . .6-26 Assigning images to tool buttons . . . . 6-45 Writing action components . . . . . . . . . .6-27 Setting tool button appearance and Registering actions. . . . . . . . . . . . . . .6-28 initial conditions . . . . . . . . . . . . . 6-46 Creating and managing menus. . . . . . . . . .6-29 Creating groups of tool buttons . . . . . 6-46 Opening the Menu Designer . . . . . . . . .6-29 Allowing toggled tool buttons . . . . . . 6-46 Building menus. . . . . . . . . . . . . . . . .6-31 Adding a cool bar component . . . . . . . . 6-47 Naming menus . . . . . . . . . . . . . . .6-31 Setting the appearance of the Naming the menu items . . . . . . . . . .6-31 cool bar . . . . . . . . . . . . . . . . . . 6-47 Adding, inserting, and deleting Responding to clicks . . . . . . . . . . . . . 6-48 menu items . . . . . . . . . . . . . . . .6-32 Assigning a menu to a tool button. . . . 6-48 Adding separator bars . . . . . . . . . . .6-32 Adding hidden toolbars . . . . . . . . . . . 6-48 Specifying accelerator keys and Hiding and showing toolbars . . . . . . . . 6-48 keyboard shortcuts . . . . . . . . . . . .6-33 Demo programs . . . . . . . . . . . . . . . . 6-49 Creating submenus. . . . . . . . . . . . . . .6-33 Chapter 7 Creating submenus by demoting existing menus . . . . . . . . . . . . . .6-34 Working with controls 7-1 Moving menu items . . . . . . . . . . . .6-34 Implementing drag-and-drop in controls . . . .7-1 Adding images to menu items . . . . . .6-35 Starting a drag operation. . . . . . . . . . . .7-1 Viewing the menu . . . . . . . . . . . . .6-35 Accepting dragged items. . . . . . . . . . . .7-2 Editing menu items in the Object Dropping items . . . . . . . . . . . . . . . . .7-2 Inspector. . . . . . . . . . . . . . . . . . . .6-35 Ending a drag operation . . . . . . . . . . . .7-3 Using the Menu Designer context Customizing drag and drop with a menu. . . . . . . . . . . . . . . . . . . . . .6-36 drag object . . . . . . . . . . . . . . . . . . .7-3 Commands on the context menu . . . . .6-36 Changing the drag mouse pointer. . . . . . .7-4 Switching between menus at design Implementing drag-and-dock in controls . . . .7-4 time. . . . . . . . . . . . . . . . . . . . .6-37 Making a windowed control a docking Using menu templates. . . . . . . . . . . . .6-37 site. . . . . . . . . . . . . . . . . . . . . . . .7-4 Saving a menu as a template . . . . . . . . .6-38 Making a control a dockable child. . . . . . .7-4 Naming conventions for template Controlling how child controls are menu items and event handlers. . . . .6-39 docked . . . . . . . . . . . . . . . . . . . . .7-5 Manipulating menu items at runtime . . . .6-40 Controlling how child controls are Making scrollable graphics . . . . . . . . 8-16 undocked . . . . . . . . . . . . . . . . . . . 7-6 Adding an image control . . . . . . . . . 8-17 Controlling how child controls respond Loading and saving graphics files. . . . . . 8-18 to drag-and-dock operations . . . . . . . . 7-6 Loading a picture from a file . . . . . . . 8-19 Working with text in controls. . . . . . . . . . . 7-6 Saving a picture to a file. . . . . . . . . . 8-19 Setting text alignment . . . . . . . . . . . . . 7-7 Replacing the picture . . . . . . . . . . . 8-20 Adding scroll bars at runtime. . . . . . . . . 7-7 Using the clipboard with graphics . . . . . 8-21 Adding the clipboard object. . . . . . . . . . 7-8 Copying graphics to the clipboard. . . . 8-21 Selecting text . . . . . . . . . . . . . . . . . . 7-8 Cutting graphics to the clipboard . . . . 8-21 Selecting all text . . . . . . . . . . . . . . . . 7-9 Pasting graphics from the clipboard. . . 8-22 Cutting, copying, and pasting text . . . . . . 7-9 Rubber banding example. . . . . . . . . . . 8-23 Deleting selected text . . . . . . . . . . . . . 7-9 Responding to the mouse. . . . . . . . . 8-23 Disabling menu items . . . . . . . . . . . . .7-10 Responding to a mouse-down action . . 8-24 Providing a pop-up menu. . . . . . . . . . .7-10 Adding a field to a form object to track Handling the OnPopup event. . . . . . . . .7-11 mouse actions . . . . . . . . . . . . . . 8-26 Adding graphics to controls . . . . . . . . . . .7-11 Refining line drawing . . . . . . . . . . . 8-27 Indicating that a control is Working with multimedia . . . . . . . . . . . . 8-28 owner-drawn . . . . . . . . . . . . . . . . .7-12 Adding silent video clips to an Adding graphical objects to a string list . . .7-12 application . . . . . . . . . . . . . . . . . . 8-29 Adding images to an application . . . . .7-13 Example of adding silent video clips . . 8-30 Adding images to a string list. . . . . . .7-13 Adding audio and/or video clips to an Drawing owner-drawn items . . . . . . .7-13 application . . . . . . . . . . . . . . . . . . 8-30 Sizing owner-draw items . . . . . . . . . . .7-14 Example of adding audio and/or video Drawing owner-draw items. . . . . . . . . .7-15 clips (VCL only) . . . . . . . . . . . . . 8-32 Chapter 8 Chapter 9 Working with graphics and Writing multi-threaded applications 9-1 multimedia 8-1 Defining thread objects. . . . . . . . . . . . . . .9-1 Initializing the thread. . . . . . . . . . . . . .9-2 Overview of graphics programming. . . . . . . 8-1 Assigning a default priority . . . . . . . .9-2 Refreshing the screen . . . . . . . . . . . . . 8-2 Indicating when threads are freed . . . . .9-3 Types of graphic objects . . . . . . . . . . . . 8-3 Writing the thread function . . . . . . . . . .9-4 Common properties and methods of Using the main VCL/CLX thread . . . . .9-4 Canvas. . . . . . . . . . . . . . . . . . . . . 8-4 Using thread-local variables . . . . . . . .9-5 Using the properties of the Canvas Checking for termination by other object . . . . . . . . . . . . . . . . . . . . . 8-5 threads . . . . . . . . . . . . . . . . . . .9-5 Using pens. . . . . . . . . . . . . . . . . . 8-5 Handling exceptions in the thread Using brushes. . . . . . . . . . . . . . . . 8-8 function . . . . . . . . . . . . . . . . . . .9-6 Reading and setting pixels. . . . . . . . . 8-9 Writing clean-up code. . . . . . . . . . . . . .9-6 Using Canvas methods to draw graphic Coordinating threads. . . . . . . . . . . . . . . .9-7 objects . . . . . . . . . . . . . . . . . . . . . 8-9 Avoiding simultaneous access . . . . . . . . .9-7 Drawing lines and polylines. . . . . . . .8-10 Locking objects. . . . . . . . . . . . . . . .9-7 Drawing shapes. . . . . . . . . . . . . . .8-11 Using critical sections . . . . . . . . . . . .9-7 Handling multiple drawing objects in Using the multi-read exclusive-write your application . . . . . . . . . . . . . . .8-12 synchronizer . . . . . . . . . . . . . . . .9-8 Keeping track of which drawing tool Other techniques for sharing memory. . .9-8 to use . . . . . . . . . . . . . . . . . . . .8-12 Waiting for other threads. . . . . . . . . . . .9-9 Changing the tool with speed buttons . .8-13 Waiting for a thread to finish Using drawing tools . . . . . . . . . . . .8-13 executing . . . . . . . . . . . . . . . . . .9-9 Drawing on a graphic . . . . . . . . . . . . .8-16 Waiting for a task to be completed . . . . 9-9 Porting Internet applications to Linux . . 10-29 Executing thread objects . . . . . . . . . . . . .9-10 Chapter 11 Overriding the default priority . . . . . . . .9-11 Starting and stopping threads . . . . . . . .9-11 Working with packages and Debugging multi-threaded applications . . . .9-12 components 11-1 Chapter 10 Why use packages?. . . . . . . . . . . . . . . . 11-2 Packages and standard DLLs . . . . . . . . 11-2 Using CLX for cross-platform Runtime packages . . . . . . . . . . . . . . . . 11-2 development 10-1 Using packages in an application . . . . . . 11-3 Creating cross-platform applications . . . . . .10-1 Dynamically loading packages . . . . . . . 11-4 Porting VCL applications to CLX . . . . . . . .10-2 Deciding which runtime packages Porting techniques . . . . . . . . . . . . . . .10-3 to use . . . . . . . . . . . . . . . . . . . . . 11-4 Platform-specific ports . . . . . . . . . . .10-3 Custom packages . . . . . . . . . . . . . . . 11-4 Cross-platform ports . . . . . . . . . . . .10-3 Design-time packages . . . . . . . . . . . . . . 11-5 Windows emulation ports . . . . . . . . .10-3 Installing component packages . . . . . . . 11-5 Porting your application. . . . . . . . . . . .10-4 Creating and editing packages . . . . . . . . . 11-6 CLX versus VCL . . . . . . . . . . . . . . . .10-5 Creating a package . . . . . . . . . . . . . . 11-6 What CLX does differently . . . . . . . . . .10-6 Editing an existing package . . . . . . . . . 11-7 Look and feel . . . . . . . . . . . . . . . .10-6 Editing package source files manually . . . 11-8 Styles. . . . . . . . . . . . . . . . . . . . .10-6 Understanding the structure of a Variants . . . . . . . . . . . . . . . . . . .10-7 package. . . . . . . . . . . . . . . . . . . . 11-8 Registry . . . . . . . . . . . . . . . . . . .10-7 Naming packages . . . . . . . . . . . . . 11-8 Other differences . . . . . . . . . . . . . .10-7 Requires clause. . . . . . . . . . . . . . . 11-8 Missing in CLX . . . . . . . . . . . . . . . . .10-8 Contains clause. . . . . . . . . . . . . . . 11-9 Features that will not port. . . . . . . . . . .10-8 Compiling packages . . . . . . . . . . . . .11-10 CLX and VCL unit comparison. . . . . . . .10-9 Package-specific compiler Differences in CLX object directives . . . . . . . . . . . . . . . . .11-10 constructors . . . . . . . . . . . . . . . . . 10-13 Using the command-line compiler Sharing source files between and linker . . . . . . . . . . . . . . . . .11-12 Windows and Linux . . . . . . . . . . . . 10-13 Package files created by a successful Environmental differences between compilation. . . . . . . . . . . . . . . .11-12 Windows and Linux . . . . . . . . . . . . 10-14 Deploying packages . . . . . . . . . . . . . . .11-13 Directory structure on Linux . . . . . . . . 10-16 Deploying applications that use Writing portable code . . . . . . . . . . . . 10-17 packages . . . . . . . . . . . . . . . . . . .11-13 Using conditional directives. . . . . . . 10-18 Distributing packages to other Terminating conditional directives . . . 10-19 developers . . . . . . . . . . . . . . . . . .11-13 Emitting messages . . . . . . . . . . . . 10-20 Package collection files . . . . . . . . . . . .11-13 Including inline assembler code. . . . . 10-20 Chapter 12 Messages and system events . . . . . . . . 10-21 Programming differences on Linux . . . . 10-22 Creating international applications 12-1 Cross-platform database applications . . . . . 10-23 Internationalization and localization . . . . . . 12-1 dbExpress differences . . . . . . . . . . . . 10-23 Internationalization . . . . . . . . . . . . . . 12-1 Component-level differences . . . . . . . . 10-24 Localization . . . . . . . . . . . . . . . . . . 12-2 User interface-level differences . . . . . . . 10-25 Internationalizing applications . . . . . . . . . 12-2 Porting database applications to Enabling application code . . . . . . . . . . 12-2 Linux. . . . . . . . . . . . . . . . . . . . . 10-25 Character sets . . . . . . . . . . . . . . . 12-2 Updating data in dbExpress OEM and ANSI character sets . . . . . . 12-3 applications . . . . . . . . . . . . . . . . . 10-27 Multibyte character sets. . . . . . . . . . 12-3 Cross-platform Internet applications . . . . . 10-29 Wide characters . . . . . . . . . . . . . . 12-4 Including bi-directional functionality Software license requirements. . . . . . . . . 13-14 in applications. . . . . . . . . . . . . . .12-4 DEPLOY . . . . . . . . . . . . . . . . . . . 13-14 BiDiMode property. . . . . . . . . . . . .12-6 README. . . . . . . . . . . . . . . . . . . 13-15 Locale-specific features. . . . . . . . . . .12-8 No-nonsense license agreement . . . . . . 13-15 Designing the user interface. . . . . . . . . .12-9 Third-party product documentation . . . 13-15 Text . . . . . . . . . . . . . . . . . . . . . .12-9 Part II Graphic images . . . . . . . . . . . . . . .12-9 Formats and sort order. . . . . . . . . . 12-10 Developing database applications Keyboard mappings . . . . . . . . . . . 12-10 Isolating resources . . . . . . . . . . . . . . 12-10 Chapter 14 Creating resource DLLs . . . . . . . . . . . 12-10 Designing database applications 14-1 Using resource DLLs. . . . . . . . . . . . . 12-12 Using databases. . . . . . . . . . . . . . . . . . 14-1 Dynamic switching of resource DLLs . . . 12-13 Types of databases. . . . . . . . . . . . . . . 14-2 Localizing applications . . . . . . . . . . . . . 12-13 Database security . . . . . . . . . . . . . . . 14-3 Localizing resources . . . . . . . . . . . . . 12-13 Transactions . . . . . . . . . . . . . . . . . . 14-4 Chapter 13 Referential integrity, stored procedures, Deploying applications 13-1 and triggers. . . . . . . . . . . . . . . . . . 14-5 Database architecture. . . . . . . . . . . . . . . 14-5 Deploying general applications . . . . . . . . .13-1 General structure . . . . . . . . . . . . . . . 14-6 Using installation programs. . . . . . . . . .13-2 The user interface form . . . . . . . . . . 14-6 Identifying application files . . . . . . . .13-2 The data module. . . . . . . . . . . . . . 14-6 Application files. . . . . . . . . . . . . . .13-3 Connecting directly to a database Package files. . . . . . . . . . . . . . . . .13-3 server . . . . . . . . . . . . . . . . . . . . . 14-7 Merge modules . . . . . . . . . . . . . . .13-3 Using a dedicated file on disk . . . . . . . . 14-9 ActiveX controls . . . . . . . . . . . . . .13-5 Connecting to another dataset. . . . . . . 14-10 Helper applications. . . . . . . . . . . . .13-5 Connecting a client dataset to another DLL locations . . . . . . . . . . . . . . . .13-5 dataset in the same application. . . . .14-11 Deploying CLX applications . . . . . . . . . . .13-6 Using a multi-tiered architecture. . . . 14-12 Deploying database applications. . . . . . . . .13-6 Combining approaches. . . . . . . . . . . 14-14 Deploying dbExpress database Designing the user interface. . . . . . . . . . 14-15 applications . . . . . . . . . . . . . . . . . .13-7 Analyzing data . . . . . . . . . . . . . . . 14-15 Deploying BDE applications . . . . . . . . .13-8 Writing reports. . . . . . . . . . . . . . . . 14-16 Borland Database Engine . . . . . . . . .13-8 SQL Links . . . . . . . . . . . . . . . . . .13-8 Chapter 15 Deploying multi-tiered database Using data controls 15-1 applications (DataSnap) . . . . . . . . . . .13-9 Using common data control features . . . . . . 15-2 Deploying Web applications . . . . . . . . . . .13-9 Associating a data control with a Deployment on Apache . . . . . . . . . . . 13-10 dataset . . . . . . . . . . . . . . . . . . . . 15-3 Programming for varying host Changing the associated dataset environments. . . . . . . . . . . . . . . . . . 13-11 at runtime. . . . . . . . . . . . . . . . . 15-3 Screen resolutions and color depths . . . . 13-11 Enabling and disabling the data Considerations when not source . . . . . . . . . . . . . . . . . . . 15-4 dynamically resizing . . . . . . . . . . 13-11 Responding to changes mediated by Considerations when dynamically the data source . . . . . . . . . . . . . . 15-4 resizing forms and controls . . . . . . 13-12 Editing and updating data . . . . . . . . . . 15-5 Accommodating varying color Enabling editing in controls on user depths . . . . . . . . . . . . . . . . . . 13-13 entry. . . . . . . . . . . . . . . . . . . . 15-5 Fonts. . . . . . . . . . . . . . . . . . . . . . 13-13 Editing data in a control. . . . . . . . . . 15-5 Operating systems versions. . . . . . . . . 13-14 Disabling and enabling data display. . . . .15-6 Hiding and showing navigator Refreshing data display . . . . . . . . . . . .15-6 buttons at runtime . . . . . . . . . . . 15-29 Enabling mouse, keyboard, and timer Displaying fly-over help . . . . . . . . . . 15-30 events . . . . . . . . . . . . . . . . . . . . .15-7 Using a single navigator for multiple Choosing how to organize the data . . . . . . .15-7 datasets . . . . . . . . . . . . . . . . . . . 15-30 Displaying a single record. . . . . . . . . . .15-7 Chapter 16 Displaying data as labels. . . . . . . . . .15-8 Displaying and editing fields in an Using decision support edit box. . . . . . . . . . . . . . . . . . .15-8 components 16-1 Displaying and editing text in a Overview . . . . . . . . . . . . . . . . . . . . . 16-1 memo control . . . . . . . . . . . . . . .15-8 About crosstabs . . . . . . . . . . . . . . . . . . 16-2 Displaying and editing text in a rich One-dimensional crosstabs. . . . . . . . . . 16-2 edit memo control. . . . . . . . . . . . .15-9 Multidimensional crosstabs . . . . . . . . . 16-3 Displaying and editing graphics Guidelines for using decision support fields in an image control . . . . . . . .15-9 components . . . . . . . . . . . . . . . . . . . 16-3 Displaying and editing data in list Using datasets with decision support and combo boxes . . . . . . . . . . . . 15-10 components . . . . . . . . . . . . . . . . . . . 16-4 Handling Boolean field values with Creating decision datasets with TQuery check boxes . . . . . . . . . . . . . . . 15-12 or TTable . . . . . . . . . . . . . . . . . . . 16-5 Restricting field values with radio Creating decision datasets with the controls. . . . . . . . . . . . . . . . . . 15-13 Decision Query editor. . . . . . . . . . . . 16-6 Displaying multiple records. . . . . . . . . 15-14 Using decision cubes . . . . . . . . . . . . . . . 16-7 Viewing and editing data with TDBGrid . . . 15-15 Decision cube properties and events . . . . 16-7 Using a grid control in its default Using the Decision Cube editor . . . . . . . 16-7 state . . . . . . . . . . . . . . . . . . . . . 15-15 Viewing and changing dimension Creating a customized grid . . . . . . . . . 15-16 settings . . . . . . . . . . . . . . . . . . 16-8 Understanding persistent columns . . . 15-16 Setting the maximum available Creating persistent columns. . . . . . . 15-17 dimensions and summaries. . . . . . . 16-8 Deleting persistent columns. . . . . . . 15-18 Viewing and changing design Arranging the order of persistent options . . . . . . . . . . . . . . . . . . 16-8 columns . . . . . . . . . . . . . . . . . 15-19 Using decision sources . . . . . . . . . . . . . . 16-9 Setting column properties at design Properties and events. . . . . . . . . . . . . 16-9 time. . . . . . . . . . . . . . . . . . . . 15-19 Using decision pivots. . . . . . . . . . . . . . . 16-9 Defining a lookup list column. . . . . . 15-20 Decision pivot properties. . . . . . . . . . 16-10 Putting a button in a column . . . . . . 15-21 Creating and using decision grids . . . . . . 16-10 Restoring default values to a Creating decision grids . . . . . . . . . . . 16-10 column . . . . . . . . . . . . . . . . . . 15-21 Using decision grids . . . . . . . . . . . . .16-11 Displaying ADT and array fields. . . . . . 15-21 Opening and closing decision grid Setting grid options . . . . . . . . . . . . . 15-23 fields. . . . . . . . . . . . . . . . . . . .16-11 Editing in the grid . . . . . . . . . . . . . . 15-25 Reorganizing rows and columns in Controlling grid drawing . . . . . . . . . . 15-25 decision grids. . . . . . . . . . . . . . .16-11 Responding to user actions at runtime. . . 15-25 Drilling down for detail in Creating a grid that contains other decision grids. . . . . . . . . . . . . . .16-11 data-aware controls . . . . . . . . . . . . . . 15-26 Limiting dimension selection in Navigating and manipulating records. . . . . 15-28 decision grids. . . . . . . . . . . . . . 16-12 Choosing navigator buttons to Decision grid properties . . . . . . . . . . 16-12 display. . . . . . . . . . . . . . . . . . . . 15-28 Creating and using decision graphs . . . . . 16-13 Hiding and showing navigator Creating decision graphs. . . . . . . . . . 16-13 buttons at design time . . . . . . . . . 15-29 Using decision graphs . . . . . . . . . . . 16-13

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.