Articles

The Action List and Action Manager Components

Action objects exists in memory but are not VCL components. In fact, they are managed by container components, called ActionList and ActionMan-ager. The former is an older and simpler actions container, the latter introduced user interface integration and generation, which are being extended. The ActionList component has a special component editor you can use to create several actions including many predefined actions and manage them. Actions are grouped in textual categories The ActionManager...

Lookup with DBLookup ComboBox

Dblookupcombobox Delphi

As stated above, when your data entry form is made of more data controls DBEdit, DBComboBox, etc. it makes sense to just use DBLookupComboBox without creating a new field. For the start, use dragging from the Fields editor to add data controls to a form. Drag Name, Author, Type and Description. This will add 4 DBEdit components and 4 Label components. At this point, remove the DBEdit connected with the Author field of the Applications table and replace it with a DBLookupComboBox. Name it...

Working with Taskbar Buttons in Windows

One of the most noticeable new features of the Windows 7 user interface is the new role of taskbar buttons, the graphic generally positioned at the bottom of the screen and showing the various applications that are currently running. In Windows 7 you can mix running applications with regularly used ones You pin a program to the taskbar and its icon will remain there even when the application is not running. These new taskbar buttons provide several ways to interact with an application. When the...

Masterdetail relationships ADO and Delphi

Page 3 Master-detail with AdoExpress components and Delphi Setting up Master Detail with ADOExpress Creating a master-detail data form is not to much complicated. Have an empty Delphi form, and just follow the steps Page 2 Realtions in Access jy Printer friendly version Join the Discussion Post your views and comments to this chapter of the free Delphi database Programming Course Discuss 1. Select the ADO page on the Component palette. Add two TADOTable components and one TADOConnection to a...

Build Configurations and Configuration Settings

As I mentioned earlier and you can see from the images on the previous pages, the Project Manager has a new Build Configurations node for every project that is, in cases where you are working with a project group with multiple projects active . This node replaces the rather cumbersome separ ate window used to manage the build configuration in Delphi 2007. Using the node and its sub-nodes you can change the current build configuration with a double click, and execute an actual build directly on...

Using the Windows Imaging Component

Another new graphic-related feature of the VCL is its support for the Windows Imaging Component WIC . This is a Microsoft framework for working with images and their metadata, which supports several image formats and can be extended with new image formats by software and hardware vendors like digital camera makers . Not only can the WIC can display images, but it has also a lot of image processing capabilities built into it and independent from the actual image format. The WIC is available in...

The Delphi Main Menu and Toolbar

The Delphi main menu has all the choices necessary to make Delphi work. Because programming in Delphi is a highly visual operation, you might not use the main menu as much as you might with other programming environments. Still, just about anything you need is available from the main menu if you prefer to work that way. I'm not going to go over every item on the main menu here because you will encounter each item as you work through the next several chapters. The Delphi toolbars provide a...

The New Category PanelGroup Control

A family of components for which we have probably seen the largest number of VCL controls available over the years has been the so-called Outlook Sidebar family, mimicking the well established interface that was originally introduced by the Microsoft email program. In modern applications, styles have changed a lot from the original collection of large icons used for the various sections of the program, but the usage of a sidebar with options and commands continues. For the first time, Delphi...

Beginning a project with a Project Template

Delphi's Project Templates provide you with predesigned projects that you can use as a starting point for your applications. Project Templates are part of the Gallery (located in the DELPHI GALLERY directory), which also provides Form Templates and Experts. When you begin a project from a Project Template (other than the Blank Project Template), you are prompted to specify a project directory, a unique subdirectory in which to store the new project files. If you specify a directory that doesn't...

Adding New Form Templates to the Object Repository

Just as you can add new project templates to the Object Repository, you can also add new form templates. Simply move to the form you want to add, right-click on it, and select Add to Repository from the local menu. In the dialog box that appears (see below), you can choose which form of the current project should be added to the Repository, and set the title, description, author, page, and icon, as usual. Once you have set these elements and clicked on OK, the form is added to the proper page...

The Empty Project Template

When you start a new project, it automatically opens a blank form, too. If you want to base a new project on one of the form objects or wizards, this is not what you want. To solve this problem, you can add an Empty Project template to the Gallery. The steps required to accomplish this are simple 2 Remove its only form from the project. 3 Add this project to the templates, naming it Empty Project. When you select this project from the Object Repository, you gain two advantages. You have your...

Refining line drawing

With fields in place to track various points, you can refine an application's line drawing. When drawing lines, track the point where the line starts with the Origin field. Origin must be set to the point where the mouse-down event occurs, so the mouse-up event handler can use Origin to place the beginning of the line, as in this code procedure TForm1.FormMouseDown(Sender TObject Button TMouseButton Shift TShiftState X, Y Integer) Drawing True Canvas.MoveTo(X, Y) Origin Point(X, Y) record where...

Managing Resources in the IDE

In the most recent versions of Delphi, you could add resource scripts (.RC files) or compiled resource files (.RES files) to the Project Manager to let it compile them along with the project linking them to the executable. In Delphi 2009 managing resources has been simplified by the inclusion of a few more tools. First, you can now drag individual resource files to the Project Manager to get them included as resources in a project. You can drag icons, bitmaps, and more. Delphi will generate a...

The RIDL Format COM Servers

Delphi Ridl

To see what this new RIDL format is all about, let s convert an existing COM project by opening it in Delphi 2009. As an example, I ve taken the SimpleServer COM example of Mastering Delphi 2005 and converted it to Delphi 2009. Beside the standard project file format conversion, Delphi warned me of the type library migration Converting ... O8 SimpleServer SimpleServer.tlb to .ridl format Reading SimpleServer.tlb Writing SimpleServer.ridl Adding SimpleServer.ridl Removing SimpleServer.tlb If we...

Add the Customized Print Preview Form to your Project

1 Select the View Project Manager option from the Delphi main menu. 2 Right-click over rbMainProj and select the Add menu option. 3 Locate rbPrvDlg.pas in the My RB Tutorials directory and add it to the project. 4 Right-click over rbMainProj and select the Options menu item. 5 Select the Forms tab and move the rbPrintPre-view form from the Auto-create list to the Available forms list. 6 Select Project Compile rbMainProj. Fix any compilation problems. 7 Select File Save from the Delphi main...

Project Manager Views

Another brand new feature is the Project Manager views configuration. On the right side of the toolbar, you can see a new Views button, that let's you change how the Project Manager shows files that have been placed in different folders. There are three options. I tested them by creating a sample program (called ProjManagerTest) with two forms in the main folder and two units in a secondary folder called Shared and placed at the same level in the file system hierarchy Directory (Nested) is the...

Create a New Application

NOTE This tutorial builds upon the masterdetail-detail report created in the previous section. You can either complete the previous tutorial or copy the rbMDD form from the RBuilder Tutori-als directory. 1 Select File New Application from the Delphi menu. This will create a new project and a blank form. 2 Close the new form and unit without saving. 3 Select File Open from the Delphi menu. Locate the rbMDD.pas unit and open it. 4 Change the form name to 'frmDrillDownSubre-port'. 5 Select File...

Saving a separate version of the project file

Delphi enables you to save a separate version of an open project in a directory other than the project directory. The FilelSave Project As command initiates the process. However, because the open project might use shared files in addition to files that were created as part of the current project, the Save Project As command saves only a copy of the project source code (.DPR) file, project options settings (.OPT file), and the project resource (.RES) file to the new location. Important No unit...

Basic Gesture Example

Rather than describing the complete VCL gesturing architecture in theory, let us start by building a very simple first example I've called Gesturesoi. The program has a form with a panel and a memo control, plus the GestureManager component. This last component doesn't have specific setting, as its editor let's you add custom gestures to it, something we will focus on later. The management of gestures takes place in the Touch property of the target control, for example the form. This property...

The New Buttoned Edit Control

Menu Drop Down Delphi

A brand new control that extends the behavior of the Edit control is the ButtonedEdit component, which is a custom VCL control defined in the ExtCtrls unit. This is basically an edit box that can have small buttons on the left or right side, used to interact with the edit box itself. For example, you can add a Cancel button that empties the edit box, and a search or lookup button that validates the input or looks for some related information. The Delphi IDE uses this component for the Search...

Using Lookup Controls

Dblookupcombobox

If the list of values is extracted from another dataset, then instead of the DBListBox and DBComboBox controls you should use the specific DBLookupListBox or DBLookupCombo-Box components. These components are used every time you want to select for a field a record of another dataset. For example, if you build a standard form for taking orders, the orders dataset will generally have a field hosting a number indicating the customer who made the order. Working directly with the customer number is...

Grouping in a List View

One common control worth exploring in some more detail is the ListView, that in Delphi 2009 receives direct support for grouping. This feature requires Windows XP or Vista, with the latter providing extended features. There are three new properties in the ListView control. The Boolean GroupView enables this new kind of display, the GroupHeaderImages refers to an ImageList containing the images for the group headers, and the Groups property is a collection of group definitions. Each group can...