1. Home
  2. Computing & Technology
  3. Delphi Programming

Understanding, Using and Enhancing Delphi VCL Components

Tutorials and articles on using Delphi components more efficiently at design and run time.
Store a String (or an Object) Along with a String in a ListBox or ComboBox
There are situations when you want to display a list of strings to the user, for example in the list box control, but also have a way to store one more additional string (or event an object instance) along the one displayed to the user. Here's how when using Delphi.
Implementing On Item Click / Double Click for Delphi's TListView control
Unfortunatelly, if you need to know what list view item was clicked or double clicked you cannot simply handle the OnClick / OnDblClick events to get the clicked item. You need to call the GetHitTestInfoAt function and make sure the click event occured over an actual item. Here's how.
Display Custom Hints for Status Bar Panels
What does not come out of the box for the TStatusBar Delphi control, is the possibility to have each panel on a status bar display its own hint (tooltip) when the mouse "stops" over a panel on a status bar. Here's how to implement TStatusPanel.Hint for each panel on a status bar.
Display Custom TTreeView Item Hints
To display different hints for every node in a tree view, you need to change the Hint property of the TTreeView control depending on the item the mouse is over. Here's how using Delphi.
Disabling Container Child Controls when Enabled property changes
When an edit box or a label is placed on a panel, in a Delphi application, if the Enabled property for the panel is set to False, the label and the edit box will *not* appear grayed - as you would expect! Here's a quick fix.
Implement a Button with a Drop Down Menu in Delphi
A "Button with a Drop Down Context Menu" appears as a normal button with an additional down arrow on the right side of the button. You will usually find such buttons on toolbars. The "arrow button" displays a drop down (popup) menu. Here's how to implement such user interface in Delphi.
Capturing a Screen Shot of a TWebBrowser Content (Web Page) in Delphi
You might need to programmatically grab the screen shot of the current page loaded in the web browser control. A custom Delphi function WebBrowserScreenShot will capture the contents of a TWebBrower's client area into a JPEG image and save it to a specified file.
Implementing "Cancel All Edits" for a Configuration-type Form in Delphi
Configuration forms often have a cancel button used to revert any edits to the edit controls back to original (initial) values. Here's how to implement such a mechanism in Delphi applications.
Rearrange Multiple TListView Items using Drag and Drop
Using Delphi's drag and drop operations it is easy to implement rearranging multiple items in a TListView control. Here's how.
Incremental Search for the TListBox Delphi Control
Imagine a list box with a huge number of (unsorted) items. Finding the one user wants to select might turn into a nightmare. Let's provide the user with an option to immediately locate the item in the list box by adding incremental search functionality.
Drawing a TComboBox: Color Pick List, Font Pick List
As with menus (menu items), an application can create an owner-drawn combo box to take responsibility for painting list items. An owner-drawn combo box can list/show information other than text strings - usually some graphical elements. Let's see how you can do it in Delphi.
Drawing on a TStatusBar Panel: Back Color, Font Color, Graphics
To have a more eye-caching user friendly interface you might want to decide to add graphics, change the color and the font style of a StatusBar Panel. Delphi's owner drawing technique let's you do that. Learn how...
Implementing the OnClick event for a Panel on a TStatusBar Delphi control
Delphi's TStatusBar control displays a row of panels, usually aligned at the bottom of a form. Unfortunatelly, Delphi does not expose "Panel Click" event to be fired when a particular Status Panel is clicked. Here's how to simulate the OnClick event for a Panel on a status bar.
Understanding Owner Drawing in Delphi
Owner Drawing - an excellent way to improve the look and feel of your Delphi application by changing the control's standard appearance.
Approaches to Automatically Testing Visual Delphi Components
The main difficulty in testing visual Delphi components is simulating mouse and keyboard events and testing the appearance of the components. This article described a method to automate the mouse and keyboard and to compare screen-captures of the components with previous versions that are believed to be correct.
How to Add Animated, Scrolling, Marquee Style Text in Delphi Programs
Spice up your user interface with a marquee style text. Use marquee style text to display scrolling text that you want to catch your Delphi program user's attention.
Using and Understanding the TCoolBar Delphi Control
Make your application user interface cool with Delphi's TCoolbar component. It's like a toolbar, except that you can place *anything* you want on it.
How to Search for Files and Folders (matching a mask)
Stop. This is the one and only solution to file searching. Use Delphi to find any file in any directory and/or subdirectory that match a certain mask. Start searching.
Create your own Windows Explorer using Delphi's File and Directory controls
The Win 3.1 Delphi components palette group includes several components that enable us to build our own custom File Open or File Save dialog box. The components are TFileListBox, TDirectoryListBox, TDriveComboBox, and TFilterComboBox. Let's see how we can build a simple File Navigating dialog box with these components and just a few lines of code.
What are Delphi Components?
Components are essential elements of the Delphi environment. It's crucial for every Delphi beginner to understand what VCL (Visual Component Library) has to offer.
Generic Solution to Coloring the Focused Entry Control
Generic solution to changing the background color (and other properties) of the focused (selected for input) Delphi control. Learn how to exploit the powers of the RTTI, OnEnter and OnExit events of a Delphi control along with the TScreen's OnActiveControlChange event to provide a more user friendly application interface.
TScreen Object Demystified
Coding the TScreen object, obtainer of all information about the current state of the screen in a Delphi application.
Managing Component Arrays in Delphi
Learn how to access a group of design-time created components - by storing the components in an array.
Create a Time Out Button / Entry Form in Delphi
If you are developing a "quiz-like", or an "exam-like" Delphi application, a user needs to make a selection and click the "Next" button, to go to the next "question". In such scenarios you might need to force a user to make a selection (choose the "answer") within a specified time interval. Here's how to code a timeout-button click...
Basic Clipboard Operations (Cut / Copy / Paste) using Delphi Code
Working with the Windows Clipboard from a Delphi application - basic operations: Cut, Copy and Paste.
How to Mimic Office 2007 Rich Menus using Owner Drawn Delphi's TMenuItems
A sample Delphi application that demonstrates how you can make your menu items take on the new look of the Office 2007 - doing rich menus using owner drawing techniques.
Understanding Drag and Drop Operations in Delphi
Delphi makes it easy to program dragging & dropping into our applications. We can even drag and drop from one form to another or from Windows Explorer to our application, or from-to what ever we want, as you will see.
Advanced Mouse Processing in Delphi Applications
More sophisticated Mouse techniques. Is mouse Present? Handling OnMouseEnter, OnMouseLeave. Restrict movement, Set Position, Faking clicks, etc.
Monitoring Mouse Activity in Delphi applications
Is the mouse over a component? Was a mouse button pressed? Which button was it? Did the user release a button, which one? Exactly where inside the form is the mouse? Did the user move the mouse out of the form into another form?
How to Get the Url of a Hyperlink when the Mouse moves Over a TWebBrowser Document
A typical Web Browser displays, in the status bar, the URL of the hyperlink when the mouse hovers over a link in a HTML document. Here's how to implement event sinking for a document displayed by the TWebBrowser component (in Delphi applications) - and get the info of a HTML element below the mouse.
How to Display Menu Item Hints in Delphi applications
By (Windows) design, in Delphi applications, hints assigned to menu items do not get displayed in the popup tooltip window (when the mouse hovers over a menu). To mimic the Windows Start menu or the Favorites menu of the Internet Explorer (and display hints for menu items) you must create your own hint window. Here's how...
How to make the Enter key work like Tab in Delphi applications
Pressing the Tab key moves the input focus to next control and Shift-Tab to previous in the tab order of the form. When working with Windows applications, most users intuitively expect the Enter key to behave like a Tab key.
Installing component packages in Delphi 2005 / Delphi for Win32 personality
Installing custom component package(s) in Borland Delphi 2005 / Delphi for Win32 personality. Adding custom components to the Tool Palette.
Creating a new component package in Delphi 2005 / Win32 personality (installing custom components)
Installing custom components in Delphi 2005 / Delphi for Win32 personality. If you need to install a third-party (or your own) Delphi component, and you only have the .PAS source file(s), follow this step-by-step tutorial and learn how to create a package to host your components.
Installing custom components in Delphi 2005 (Delphi for Win32)
In Delphi 2005 custom components are installed in the IDE as packages (BPL files). If you need to install custom component(s), and you have source files (units containing the components), with Delphi 2005 (for Win32) you need to create a package to host the components prior to installing the components in the Tool Palette. Here's how...
Installing a single source Delphi component into an existing Package
If you need to install a third-party Delphi component, and you only have a .PAS source file(s), follow this step-by-step tutorial and learn how to add the component into an existing package. This tutorial covers installing components in Delphi for Win32 (Delphi 7).
Tips, tricks and code samples
A collection of tricks and code samples to help you use the VCL better.
Accessing 'Configuration Settings' files (.INI) with Delphi
How a simple text file can beat Registry in storing a few pieces of application specific configuration data. The TIniFile class explained!
ENTERing TAB
Using the Enter key like a Tab key with Delphi controls.
Exploring Directories and Files
Creating custom file-selection and directory-navigation forms (dialogs) with file system components.
Get Crazy - Draw Yourself
Owner Drawing - an excellent way to improve the look and feel of your Delphi application by changing the control's standard appearance. Creating a graphical (popup) menu.
ListBox to the Max
The main purpose of a TListBox component is displaying a collection of items in a scrollable list. Here are some list box tips to make a ListBox component more powefull...
Mail me, Link me...
Let us improve standard TLabel component, so that it acts like a link in a web page.
Shell Controls: Delphi's Hidden Gems
How to create a reasonable Delphi facsimile of the Windows explorer, all without writing a single line of code.
TMemo to the Max
Ever needed to set some additional properties to the standard Memo component? By default you use the Tmemo when you need a standard Windows multiline edit control on a form. Here are some nifty TMemo related tips and tricks.
Moving the contents of a ScrollBox with mouse
How to move a TImage object in a ScrollBox with the mouse, like a Drag and Drop operation - without the scroll bars.
Quick Reports Tutorial
Extensive tutorial on printing with Quick Report components and Delphi.
Streams, streams, ... TStream
A stream is what its name suggests: a flowing "river of data". A stream has a beginning, an end, and you're always somewhere in between of these two points. Learn about using the TStream class in Delphi: how to use stream objects to read from, write to, or copy information stored in a particular medium.
TWebBrowser to the Max
TWebBrowser component provides access to the Web browser functionality from your Delphi apps. Here are some nifty WebBroswer related tips and tricks...
TreeView to the Max
The TTreeView Delphi component represents a window that displays a hierarchical list of items, such as the headings in a document, the entries in an index, or the files and directories on a disk. Here are some tutorials, articles, tips and info on using the TTreeView component...
TScreen Object Demystified
Coding with the TScreen object, obtainer of all information about the current state of the screen in a Delphi application.
ActionBands
The article explains some new actions features added in Delphi 6, including ActionBands.
Placing a TProgressBar into a TStatusBar
Here's how to add a status bar (or any other Delphi component) to a progress bar. Provide visual feedback of application's lengthy operation in the status area of a Delphi form.
Placing a TProgressBar into a TListView
Here's how to add a progress bar (or any other Delphi component) to a ListView control. Plus: full source code to the TListViewEx component (TListView descendant) with ColumnResize events!
Actions: Lights...Camera...Action!
With an ActionList, we can group and manage "actions" (event handling code) between different components and even re-use them among different applications!
Using Collections
Collections are used for managing lists of items. However, unlike the TList or the TStringList classes, collections manage items that are of the same type. Two common examples of collections are the Panels property of TStatusBar and the Columns property of TDBGrid.
Controls Demystified
Using components is easy. This article helps understanding Delphi controls deeper.
Replacing TabSheets with Frames
Using TFrames, interfaces and inheritance, you can overcome the limitations of using TTabSheets in your application
Dynamic Arrays: The TList Class
The TList class is most often used when you need an array whose size can change at run time.
Images in a Combo Box
How to. An easy description of customizing the standard combobox.
Introduction to Rave Reports - Part I: Code Based Reports
Delphi 7 has included Rave Reports as the default reporting solution, replacing Quick Reports. This is a introduction to Rave Reports. Part I describes how to work with Code Base reports
Introduction to Rave Reports - Part III: Data Aware Reports
Part III describes how to create Data Aware Reports using Driver Data Views.
Optimizing Delphi Lists and Strings
Lists, strings, and string lists are among the most commonly used Delphi data structures, so obtaining some extra speed from them can benefit most applications. This presentation also helps you figure out how to port similar code to Delphi for the Microsoft .NET Framework
Introduction to Rave Reports - Part II: Visual Designer
Part II describes how to work with the Visual Designer.
Resizing the Drop-down List of a TComboBox
"Can I resize the drop-down list of a TComboBox so that I can see the complete text of its items?"
Syntax Highlighting With RichEdit
How to add syntax highlighting capabilities to the RichEdit control.
ModelMaker tutorials
These tutorials provide a good starting point for those wishing to become proficient in ModelMaker, the UML/CASE tool included in Delphi 7 Enterprise and Delphi 7 Architect. Topics include basic: Importing Existing Code; intermediate: Creating Classes within Diagrams and Advanced: Creating plugins with the ModelMaker OpenTools API.
TCollection Performance Issues and Solutions
Delphi 3,4,5 TCollection Performance Issues and Solutions
Revamp Your Main Menu with Delphi 7
How to give a new (XP) look and feel to your Delphi 7 applications using the ActionManager.
Introduction to Rave Reports - Part IV: More Data Aware Reports
Part IV shows how to create Master/Detail reports using Direct Data Views
TFileStream: Saving List Box Data at Runtime
How do I save data entered in a list box at run time without resorting to a text file or having to deal with the overhead of a table?
TRichEdit
Here you will find information on using OLE with Rich Edit controls, using the Rich Edit, answers to frequently asked questions about Rich Edit controls, and other useful information.
User Customisable Keyboard Shortcuts
See how easy is to add user customisable key bindings to your Delphi projects.
Visual Component Development in Delphi using Frames
A frame is a container class that permits you to visually design compound components. In addition, the design understands the relationship between a frame and the components it contains, permit you to override the properties and event handlers of objects that appear in frame instances.

Explore Delphi Programming

More from About.com

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Using VCL Components

©2008 About.com, a part of The New York Times Company.

All rights reserved.