2012. Delphi Programming by Zarko Gajic
All of your favorite Delphi tutorials, articles, tips and tricks, VCL top picks, tool reviews, source code projects on Delphi Programming and a lot lot more, sorted by date.
Delphi Almanacs: 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998.
Have a Delphi Function Return Multiple Results / Values - December 11, 2012
A return value from a function is defined by the return type.
I guess that in most cases you would write a function to return a single value that would be an integer, string, boolean or some other simple type, also return types could be an array, a string list, an instance of a custom object or alike. Note that even if your function returns a string list (a collection of strings) it still returns a single value: one instance of the string list.
Extending Delphi Sets (And Other Simple Types) With Functions and Procedures - November 27, 2012
In XE3 Delphi version, record helpers became more powerful by allowing to extend simple Delphi types like strings, integers, enums, sets and alike. Here's a sample helper for a set of bytes.
Virtual TreeView - About & How To Install (Open Source Delphi Treeview Component) - November 23, 2012
The Virtual TreeView, initially being developed by Mike Lischke and now being maintained as an open source project on Google Code is a must-use control if you are up to working with whatever you could call "nodes".
TStringGrid Drawing: Background, Alignment, Colors - October 23, 2012
Owner draw does not need to be specifically set (as one has to with a TListBox), one just places drawing code in the event handler and it is called by the class code after drawing the grid.
Reposition A MessageDlg To Your (Delphi Application) Main Form - October 16, 2012
A custom MessageDlgPos function you can use in your Delphi applications to decide if you want to center the dialog on your main form, owner form, screen center and so on simply by passing a particular type variable.
Understanding Delphi Class (and Record) Helpers - September 18, 2012
In simple words, a class helper is a construct that extends a class by introducing new methods in the helper class. A class helper allows you to extend existing class without actually modifying it or inheriting from it.
Debug vs. Release In Delphi - September 11, 2012
Since you can activate each of the build configurations you see in the Project Manager, then build your project producing a different executable file, the question is what is the difference between Debug and Release in Delphi?
Two Applications In One Delphi Program/Project - $IFDEF & MSBuild - August 28, 2012
Questions answered include: Creating a custom build configuration, specifying a custom conditional symbol, linking different forms depending on conditional compilation, renaming the generated executable file...
Delphi Conditional Compilation 101: Project Group, Project, Program: Debug or Release? - August 23, 2012
If you would like to have the same code base in one program but also have an option to build two (or more) different applications - you should be looking at Delphi's conditional compilation.
Using And Understanding The TDictionary (Hash Table) Class In Delphi - July 13, 2012
Introduced in Delphi 2009, the TDictionary class, defined in Generics.Collections unit, represents a generic hash table type collection of key-value pairs.
Programmatically Check If Your 32-bit Delphi Application Is Running On 32-bit Or 64-bit Windows - July 6, 2012
While I do have Delphi XE 2 (supporting native x64 development) I am still compiling some of my applications as 32-bit applications (waiting for some 3rd party to move to x64). Having my x86 (32-bit) application running on various Windows versions - I need a way to know if my 32 bit application is running on Windows x86 (32-bit) or x64 (64 bit).
Implementing Delphi Sets To Hold Up To 65536 Integer Elements - June 26, 2012
Sets are frequently used with enumerated values (having integer values beneath), and if needing to operate on more than 256 elements - you would need a different approach.
How Many Times A String Appears Inside Another String? - June 5, 2012
While the SysUtils unit and the StrUtils unit provide hundreds of string manipulation routines there are always some that are "missing". A function I need daily is the one that return the number of how many times a string appears inside another string.
How Many Times A String Appears Inside Another String? - June 5, 2012
While the SysUtils unit and the StrUtils unit provide hundreds of string manipulation routines there are always some that are "missing". A function I need daily is the one that return the number of how many times a string appears inside another string.
Interfaces in Delphi Programming 102 - Properties In Interfaces, Same Named Methods, ... - May 22, 2012
The Interfaces in Delphi Programming 101 introduced programming with interfaces in Delphi. An interface is like an abstract class - but not the same. While you cannot instantiate an abstract class, you can have a class implement an interface and be equipped with special functionality.
Limit The Number Of Characters For The TListView's Editor Control - May 18, 2012
The ReadOnly property of a List View, determines whether the user can change the contents of the control - caption of an item. Since using TEdit we (Delphi developers) are used to have the MaxLength property. Here's how to limit the number of characters a user can enter into the ListView's editor control.
Add A Grab Bar To The TSplitter - April 24, 2012
The TSplitter Delphi control does a nice job of allowing the user to resize user elements like panels on a form to make 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 splitters - without having to redesign your user interface.
Implementing Floating / Dockable Forms Without Dragging Or Dock Sites - April 7, 2012
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.
How To Show The Copyright © Symbol In A Caption (Label, Form) In Delphi Applications - April 3, 2012
The question is easy and simple: how do you add the copyright symbol "©" to a string? The string can be used for the Caption property of a Delphi control (Form, Label, and alike). The answer is as simple, but might be tricky for novice users :)
On Reraising Exceptions in Delphi Exception Handling - March 13, 2012
A discussion on how to handle and what happens when you handle exceptions in your Delphi code is provided as the intro article. This time, we'll see how you can explore exceptions being raised and handled and how to properly re-raise exceptions.
Maze Creation and Solving Tool - Source Code Delphi Application - March 9, 2012
A maze (or labyrinth, even though not a synonim) is a complex structure with a series of interconnecting pathways - walls making dead ends. Maze is a very simple Delphi application designed to help you create mazes of almost any size. You an customize the way the maze is displayed and you can set entry and exit points for the maze with the click of a mouse button.
How To And What Happens When You Handle (Or Not) Exceptions In Your Delphi Code - February 28, 2012
For the starters: what's an error in an application? What's an exception? How to trap exceptions? Why your Delphi application does not crash like some .Net apps do, etc...
Reraising Exceptions in Delphi - How to Properly - A Poll - February 21, 2012
Now, let's say you need to re-raise an exception in your code handing exceptions. You would reraise the exception if it is not the one you know how / want to handle specifically.
Deactivating the TShellTreeView Delphi Control - Faking the Active Property - January 23, 2012
When the form hosting the shelltreeview is created, the TShellTreeView will read the shell structure and populate the tree. Note that the component is not visible by default - therefore not "needed" at form creation. The process of enumerating the shell as done by the component takes some time (a few seconds) and it appears as is the application has frozen.
How Do You Test If a Delphi String Starts With a (Sub)String? What RTL Function is Faster? - January 9, 2012
Let's say that you need to determines whether the beginning of a string matches a specified string? Delphi provides at least 4 ways to check if a string starts with another (sub)string.
Delphi Almanacs: 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998.
Delphi Programming Almanac 2012
Have a Delphi Function Return Multiple Results / Values - December 11, 2012
A return value from a function is defined by the return type.
I guess that in most cases you would write a function to return a single value that would be an integer, string, boolean or some other simple type, also return types could be an array, a string list, an instance of a custom object or alike. Note that even if your function returns a string list (a collection of strings) it still returns a single value: one instance of the string list.
Extending Delphi Sets (And Other Simple Types) With Functions and Procedures - November 27, 2012
In XE3 Delphi version, record helpers became more powerful by allowing to extend simple Delphi types like strings, integers, enums, sets and alike. Here's a sample helper for a set of bytes.
Virtual TreeView - About & How To Install (Open Source Delphi Treeview Component) - November 23, 2012
The Virtual TreeView, initially being developed by Mike Lischke and now being maintained as an open source project on Google Code is a must-use control if you are up to working with whatever you could call "nodes".
TStringGrid Drawing: Background, Alignment, Colors - October 23, 2012
Owner draw does not need to be specifically set (as one has to with a TListBox), one just places drawing code in the event handler and it is called by the class code after drawing the grid.
Reposition A MessageDlg To Your (Delphi Application) Main Form - October 16, 2012
A custom MessageDlgPos function you can use in your Delphi applications to decide if you want to center the dialog on your main form, owner form, screen center and so on simply by passing a particular type variable.
Understanding Delphi Class (and Record) Helpers - September 18, 2012
In simple words, a class helper is a construct that extends a class by introducing new methods in the helper class. A class helper allows you to extend existing class without actually modifying it or inheriting from it.
Debug vs. Release In Delphi - September 11, 2012
Since you can activate each of the build configurations you see in the Project Manager, then build your project producing a different executable file, the question is what is the difference between Debug and Release in Delphi?
Two Applications In One Delphi Program/Project - $IFDEF & MSBuild - August 28, 2012
Questions answered include: Creating a custom build configuration, specifying a custom conditional symbol, linking different forms depending on conditional compilation, renaming the generated executable file...
Delphi Conditional Compilation 101: Project Group, Project, Program: Debug or Release? - August 23, 2012
If you would like to have the same code base in one program but also have an option to build two (or more) different applications - you should be looking at Delphi's conditional compilation.
Using And Understanding The TDictionary (Hash Table) Class In Delphi - July 13, 2012
Introduced in Delphi 2009, the TDictionary class, defined in Generics.Collections unit, represents a generic hash table type collection of key-value pairs.
Programmatically Check If Your 32-bit Delphi Application Is Running On 32-bit Or 64-bit Windows - July 6, 2012
While I do have Delphi XE 2 (supporting native x64 development) I am still compiling some of my applications as 32-bit applications (waiting for some 3rd party to move to x64). Having my x86 (32-bit) application running on various Windows versions - I need a way to know if my 32 bit application is running on Windows x86 (32-bit) or x64 (64 bit).
Implementing Delphi Sets To Hold Up To 65536 Integer Elements - June 26, 2012
Sets are frequently used with enumerated values (having integer values beneath), and if needing to operate on more than 256 elements - you would need a different approach.
How Many Times A String Appears Inside Another String? - June 5, 2012
While the SysUtils unit and the StrUtils unit provide hundreds of string manipulation routines there are always some that are "missing". A function I need daily is the one that return the number of how many times a string appears inside another string.
How Many Times A String Appears Inside Another String? - June 5, 2012
While the SysUtils unit and the StrUtils unit provide hundreds of string manipulation routines there are always some that are "missing". A function I need daily is the one that return the number of how many times a string appears inside another string.
Interfaces in Delphi Programming 102 - Properties In Interfaces, Same Named Methods, ... - May 22, 2012
The Interfaces in Delphi Programming 101 introduced programming with interfaces in Delphi. An interface is like an abstract class - but not the same. While you cannot instantiate an abstract class, you can have a class implement an interface and be equipped with special functionality.
Limit The Number Of Characters For The TListView's Editor Control - May 18, 2012
The ReadOnly property of a List View, determines whether the user can change the contents of the control - caption of an item. Since using TEdit we (Delphi developers) are used to have the MaxLength property. Here's how to limit the number of characters a user can enter into the ListView's editor control.
Add A Grab Bar To The TSplitter - April 24, 2012
The TSplitter Delphi control does a nice job of allowing the user to resize user elements like panels on a form to make 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 splitters - without having to redesign your user interface.
Implementing Floating / Dockable Forms Without Dragging Or Dock Sites - April 7, 2012
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.
How To Show The Copyright © Symbol In A Caption (Label, Form) In Delphi Applications - April 3, 2012
The question is easy and simple: how do you add the copyright symbol "©" to a string? The string can be used for the Caption property of a Delphi control (Form, Label, and alike). The answer is as simple, but might be tricky for novice users :)
On Reraising Exceptions in Delphi Exception Handling - March 13, 2012
A discussion on how to handle and what happens when you handle exceptions in your Delphi code is provided as the intro article. This time, we'll see how you can explore exceptions being raised and handled and how to properly re-raise exceptions.
Maze Creation and Solving Tool - Source Code Delphi Application - March 9, 2012
A maze (or labyrinth, even though not a synonim) is a complex structure with a series of interconnecting pathways - walls making dead ends. Maze is a very simple Delphi application designed to help you create mazes of almost any size. You an customize the way the maze is displayed and you can set entry and exit points for the maze with the click of a mouse button.
How To And What Happens When You Handle (Or Not) Exceptions In Your Delphi Code - February 28, 2012
For the starters: what's an error in an application? What's an exception? How to trap exceptions? Why your Delphi application does not crash like some .Net apps do, etc...
Reraising Exceptions in Delphi - How to Properly - A Poll - February 21, 2012
Now, let's say you need to re-raise an exception in your code handing exceptions. You would reraise the exception if it is not the one you know how / want to handle specifically.
Deactivating the TShellTreeView Delphi Control - Faking the Active Property - January 23, 2012
When the form hosting the shelltreeview is created, the TShellTreeView will read the shell structure and populate the tree. Note that the component is not visible by default - therefore not "needed" at form creation. The process of enumerating the shell as done by the component takes some time (a few seconds) and it appears as is the application has frozen.
How Do You Test If a Delphi String Starts With a (Sub)String? What RTL Function is Faster? - January 9, 2012
Let's say that you need to determines whether the beginning of a string matches a specified string? Delphi provides at least 4 ways to check if a string starts with another (sub)string.
Source...