1. Technology
Send to a Friend via Email

Understanding, Using and Enhancing Delphi VCL Components

Tutorials and articles on using Delphi Visual Component Library (VCL) controls and components more efficiently at design and run time.
  1. Button, BitBtn, SpeedButton (10)
  2. TComboBox (6)
  3. TEdit, TMaskEdit (13)
  4. TImage (8)
  5. TListBox (16)
  6. TListView (12)
  7. TMemo, TRichEdit (24)
  8. TMouse (20)
  9. TPageControl (4)
  10. TProgressBar (5)
  11. TRadioButton, TCheckBox (7)
  12. TStatusBar (6)
  13. Using Database Components
  14. Creating VCL components (24)
  15. Run time VCL creation (10)
  16. TLabel, TStaticText (7)
  17. TTreeView (12)
  18. TWebBrowser (20)
  19. TPrinter printing (3)

Owner Drawing The String Grid
For StringGrids with simple content the default drawing action is sufficient, but when various aligns or different colours need to be included in the stringgrid, drawing code must be written in the OnDrawCell event to support owner draw. Owner draw does not need to be specifically set (as one has to with a TListBox), one just places drawing code...

Need More Images For A Virtual Tree View Node?
When using the TVirtualStringTree, each tree node can have several images. One is the check image which is supplied by internal image lists or a special external list (CustomCheckImages property). Another one is the state image and yet another one the normal/selected image. What to do when more images are needed for a node...

Dock And Float Forms In Delphi - No Dragging
There's a group of controls on a tab sheet of a page control. There's a group of controls on a panel. Here's how to undock the controls from their original parent and make them float in a floating form / window. And unfloat / dock again. No dragging, no docking sites, easy and scalable.

Crypting Your Delphi Application INI (Configuration) Files
In most of my Delphi applications I'm using INI files to store configuration options. For one particular situation I wanted to somehow hide the content of the INI file. Yes, INI files are not to be used to store critical data, but in this case I only simply wanted to have a no-eye situation. Let's see how to crypt and uncrypt INI files.

Select XML Nodes Into IXMLNodeList Using XPath In Delphi's XmlDom
Select XML Nodes Into IXMLNodeList Using XPath In Delphi's XmlDom

Deactivating the TShellTreeView Delphi Control - Faking the A…
Delphi's TShellTreeView component displays a hierarchical tree view of the system's shell folders and files. The ObjectTypes property of the ShellTreeView determines what shell elements are displayed by the control: folder or files or both. Since it can take some time until the control renders its content - I have found myself looking for an Active property...

Using Margins and Padding Properties in Delphi's VCL
One of the neateast new properties (in Delphi versions 2006 and up) you can find in the Object Inspector are the Margins, Padding and AllignWithMargins. For me, there's no user interface like the one you can set up using just a few panels, their Align property and now with the help of Margins and Padding the UI gets even better.

Extending TWinControl with a ViewOnly property
ViewOnly property is a mix of Enabled and ReadOnly where the control with ViewOnly set to true will not be grayed, will be read only but a user will not be able to set the input focus to the control. Class helper to add the ViewOnly property to all TWinControl descendants.

Extending TCustomEditControls (TMemo, TRichEdit) with a ViewOnly property
In Delphi, descedants of the TCustomEdit type, like TEdit, TMemo and TRichEdit, expose two properties you can use to make the editor not-editable: ReadOnly and Enabled. How about a ViewOnly property that would be a mix or Enabled and ReadOnly where the control with ViewOnly set to true will not be grayed, will be read only but a user will not be able to set the input focus to the control?

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.

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.

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.

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.

Basic Clipboard Operations (Cut / Copy / Paste) using Delphi Code
The Windows Clipboard represents the container for any text or graphics that are cut, copied or pasted from or to an application. This article will show you how to use the TClipboard object to implement cut-copy-paste features in your Delphi application.

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 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 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).

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!

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.

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.

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.

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.

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.

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?"

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?

Add Custom Sorting To Delphi's TShellListView Control
By design, Delphi's TShellListView sorts files (and folders) ascending by their name. There's no "OnCompare" event you can handle to change the sort order or the column (name, type, date modified, size) used for sorting. Here's how to implement custom sorting in shell list view.

Add A Grab Bar To The TSplitter
The TSplitter Delphi control does a nice job of allowing the user to resize user elements like panels on a form to make the the user interface more flexible. A nice to have for a splitter would be to have a grab bar - and here's how to easily paint one on all your splitter - without having to redesign your user interface.

©2014 About.com. All rights reserved.