Overview of the Tools API

All of the Tools API declarations reside in a single unit, ToolsAPI. To use the Tools API, you typically use the designide package, which means you must build your Tools API add-in as a design-time package or as a DLL that uses runtime packages. For information about package and library issues, see Installing the wizard package on page 14-4. The main interface for writing a Tools API extension is IOTAWizard, so most IDE add-ins are called wizards. C++Builder and Delphi wizards are, for the most...

Creating properties

Properties are the most visible parts of components. The application developer can see and manipulate them at design time and get immediate feedback as the components react in the Form Designer. Well-designed properties make your components easier for others to use and easier for you to maintain. To make the best use of properties in your components, you should understand the following Publishing inherited properties Storing and loading properties From the application developer's standpoint,...

Working with pictures

Most of the graphics work you do in Delphi is limited to drawing directly on the canvases of components and forms. Delphi also provides for handling stand-alone graphic images, such as bitmaps, metafiles, and icons, including automatic management of palettes. There are three important aspects to working with pictures in Delphi Using a picture, graphic, or canvas Loading and storing graphics There are three kinds of classes in Delphi that deal with graphics A canvas represents a bitmapped...

Component Writers Guide

100 Enterprise Way, Scotts Valley, CA 95066-3249 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...

Obtaining Tools API services

To do anything useful, a wizard needs access to the IDE its editors, windows, menus, and so on. This is the role of the service interfaces. The Tools API includes many services, such as action services to perform file actions, editor services to access the source code editor, debugger services to access the debugger, and so on. Table 14.2 summarizes all the service interfaces. Table 14.2 Tools API service interfaces Interface Description INTAServices Provides access to native IDE objects main...

Adding property editors

The Object Inspector provides default editing for all types of properties. You can, however, provide an alternate editor for specific properties by writing and registering property editors. You can register property editors that apply only to the properties in the components you write, but you can also create editors that apply to all properties of a certain type. At the simplest level, a property editor can operate in either or both of two ways displaying and allowing the user to edit the...

Creating forms and projects

Delphi comes with a number of form and project wizards already installed, and you can write your own. The Object Repository lets you create static templates that can be used in a project, but a wizard offers much more power because it is dynamic. The wizard can prompt the user and create different kinds of files depending on the user's responses. This section describes how to write a form or project wizard. A form or project wizard typically creates one or more new files. Instead of real files,...

Creating new message handlers

Because the VCL provides handlers for most common messages, the time you will most likely need to create new message handlers is when you define your own messages. Working with user-defined messages has three aspects Defining your own messages. Declaring a new message-handling method. A number of the standard components define messages for internal use. The most common reasons for defining messages are broadcasting information not covered by standard messages and notification of state changes....

Adding graphic capabilities

Once you have declared your graphic component and published any inherited properties you want to make available, you can add the graphic capabilities that distinguish your component. You have two tasks to perform when creating a graphic control In addition, for the shape control example, you will add some properties that enable application developers to customize the appearance of the shape at design time. A graphic control can change its appearance to reflect a dynamic condition, including...

Property categories

In the IDE, the Object Inspector lets you selectively hide and display properties based on property categories. The properties of new custom components can be fit into this scheme by registering properties in categories. Do this at the same time you register the component by calling RegisterPropertyInCategory or RegisterPropertiesInCategory. Use RegisterPropertyInCategory to register a single property. Use RegisterPropertiesInCategory to register multiple properties in a single function call....

Creating the component interface

These are the steps to create the component interface For your wrapper component to initialize and display the wrapped dialog box, you must add the form's unit to the uses clause of the wrapper component's unit. Append About to the uses clause of the AboutDlg unit. The uses clause now looks like this Windows, SysUtils, Messages, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, About The form unit always declares an instance of the form class. In the case of the About box, the...

Creating a data editing control

When you create a data editing control, you create and register the component and add the data link just as you do for a data browsing control. You also respond to data changes in the underlying field in a similar manner, but you must handle a few more issues. For example, you probably want your control to respond to both key and mouse events. Your control must respond when the user changes the contents of the control. When the user exits the control, you want the changes made in the control to...

Responding to system notifications using CLX

When using Windows, the operating system sends notifications directly to your application and the controls it contains using Windows messages. This approach, however, is not appropriate for CLX applications, because CLX is a cross-platform library, and Windows messages are not used on Linux. Instead, CLX uses a platform-neutral way to respond to system notifications On CLX, the analog to Windows messages is a system of signals from the underlying widget layer. Whereas in the VCL, Windows...

Overview of component creation

This chapter provides an overview of component design and the process of writing components for Delphi applications. The material here assumes that you are familiar with Delphi and its standard components. What goes into a component Testing uninstalled components Testing installed components Installing a component on the Component palette For information on installing new components, see Installing component packages on page 16-10 of the Developer's Guide. Delphi's components reside in a...

Creating a data browsing control

Creating a data-aware calendar control, whether it is a read-only control or one in which the user can change the underlying data in the dataset, involves the following steps Creating and registering the component. Responding to data changes. Creating and registering the component You create every component the same way create a unit, derive a component class, register it, compile it, and install it on the Component palette. This process is outlined in Creating a new component on page 1-8. For...

Adding component editors

Component editors determine what happens when the component is double-clicked in the designer and add commands to the context menu that appears when the component is right-clicked. They can also copy your component to the Windows clipboard in custom formats. If you do not give your components a component editor, Delphi uses the default component editor. The default component editor is implemented by the class TDefaultEditor. TDefaultEditor does not add any new items to a component s context...