1. Technology

2006. Delphi Programming by Zarko Gajic

Delphi Programming Almanac For the Year 2006


How to Re-Initialize an Object to its Default State - 07/03/2006
While an object (instance of a class) lives, property values get changed. Here's how to simply re-initialize an object to default (property) values...

How to Disable TEdit's Default PopUp (Context) Menu - 06/26/2006
When a user right-clicks on an Edit component at run time (or any other component that allows editing such as MaskEdit, Memo, DbEdit, etc.), by default the system's context menu pops up with options to undo, copy, paste, etc. One way to get rid of this default popup menu is to handle the OnContextPopup event by setting the Handled parameter to True.

Programmatically Get and Set the State of the CapsLock and NumLock Keys - 06/19/2006
The VK_CAPITAL virtual key constant defines the Caps Lock key. The VK_NUMLOCK constant defines the Num Lock key. If you need to programmatically turn on or off the Caps Lock or Num Lock key, you can use the code provided in this tip.

Adding Advanced User Controls to a Web Page Dynamically - 05/30/2006
A Beginner's Guide to ASP.NET Programming for Delphi developers: Chapter 24. User Controls allow a Delphi ASP.NET developer to wrap the common UI features of a web applications into reusable components. In real world applications you'll want to be able to dynamically load a user control and place it on the page. What Page event should you use to LoadControl? Once on the page, how do you handle User Control events? Find the answers in this chapter ...

Add you Delphi application to the Windows "Send To" menu - 05/29/2006
Another approach to allowing the user to send a file to your Delphi application for processing, without the need to register a file type, is to add your application to the special Windows 'Send To' menu. Here's how to programmatically add your application to the 'Send To' menu.

Developing and Using Custom User Controls in ASP.NET - 05/23/2006
A Beginner's Guide to ASP.NET Programming for Delphi developers: Chapter 23. Much similar to Win32 Delphi's TFrame objects, an ASP.NET User Control is a container for components; it can be nested within Web Forms or other User Controls. User controls offer you an easy way to split and reuse common user interface functionality across the pages of your ASP.NET Web application.

Drawing a Focus Rectangle Around the Active Control - 05/22/2006
By using the OnActiveControlChange event of the Delphi's TScreen class you can change the background color of the active input control. To create event more eye-catching effect you could 'draw' a rectange around the focused control.

Generic Solution to Coloring the Focused Entry Control - 05/16/2006
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.

Detach an Event Handler from a Control Event - 05/15/2006
Almost all the code you write in your Delphi applications is executed, directly or indirectly, in response to events. For example, when a user clicks a button, an OnClick event is being raised. You can write an event handling procedure to react on this event. Here's how to detach (remove, disable) the event handling code from the event...

Managing Component Arrays (Created at Run-Time) in Delphi - 05/09/2006
Learn how to access a group of programmatically created components - by storing the components in an array.

Draw a Gradient Fill on a Canvas - 05/08/2006
Here a two custom Delphi functions to paint a Canvas object using gradient fill from one color value to another, either vertical or horizontal ...

Managing Component Arrays (Created at Design-Time) in Delphi - 05/02/2006
Learn how to access a group of design-time created components - by storing the components in an array.

Animate (Scroll) Application Title on the TaskBar - 05/01/2006
If a lengthy process is about to start in you Delphi application, you can indicate that the process is still running by, for example, animating the title of your application, i.e. animating the caption of your application's TaskBar button.

Create a Windows Start-Up Manager - 04/25/2006
How to build a program (using Delphi) that allows a user to control which applications will run when Windows starts up. Full source code (heavily documented) included.

Create a Resizable Form with No Border - 04/24/2006
There may be situations when you want to remove a form's border (and title bar) *but* still leave the option for a user to resize the form. Here's how...

Create a Time Out Button / Entry Form - 04/18/2006
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...

TListBox with Radio Buttons - 04/17/2006
Here's how to draw a radio button for each of the items in a List Box...

Build your First "Hello World VIRUS" - 04/11/2006
Who said programming cannot be fun? Let's create a simple "memory eater" that executes itself an unlimited number of times - thus consuming all the Windows memory :) Ah, ok. This Virus will also free the memory it occupies.

Display "Bold" Items in the TTreeView - 04/10/2006
By default (Windows drawing), all items (tree nodes) of a tree view share the same font styling. If you only want to apply *bold* to some tree items (their Captions), you can use a "special" TreeView API. Here's how to *bold* tree items in Delphi applications.

Dynamically Add Items (Holding Custom Properties) to a TPopUp Delphi Menu - 04/04/2006
How to add menu items to a Menu (or Popup menu) at run-time, how to respond to the OnClick event. Plus: how to extend the TMenuItem to hold custom string property.

Access a TRadioButton from a TRadioGroup - Disable, Change Font, etc. - 04/03/2006
Here's how to access a specific radio button either by Index or by Caption. When you "grab" the TRadioButton you can disable it, change its color, etc...

©2014 About.com. All rights reserved.