|A lot of Delphi info is available via my general Languages page (which shows how to implement various common constructs in various languages) and my general Database page.
|Writing your own Components
|The ability to write your own components IS what makes Delphi
the superior language. However, the learning curve is very steep.
Creating a Component discusses just the basic mechanics of how to create one.
Component Directory Structure describes (and explains) one of the structures I use.
Writing your own Components covers what goes into a component.
Property Editors shows various techniques.
How to handle ScrollWheel events.
Component Testing describes some additional tests required for components.
Creating and Installing Packages - If you want your component to have a design time presence (placed on the toolbar - Component palette - and be able to set parameters via the Object Inspector), then they must be placed in a package and installed in the IDE. They will also need a Register function that calls RegisterComponents. Component Debug describes a few problems that might occur at this stage.
Based on the provided instructions, I found writing the associated help file to be more difficult than developing a component. (A component without a help file is worthless.)
|Drawing on a Form
|Using a Canvas to draw images
|How to build Delphi exe's and dll's that are designed to be called by a web server (such as PWS/IIS) and displayed in a web browser.
|How to read and write databases.
|File I/O Component
|This component encapsulates all the normal File I/O commands. It also includes Open and Save dialog boxes and Actions that simplify menu design.
|Includes information on a Windows XP design problem
|How to interface with the Serial Port (ComPort)
|How to display images (bmp, ico, jpeg ...) on a form. Additional icon, jpeg and png info.
|Notes on declaring methods.
|User Interface Design
|Menus, Toolbars, and Actions
|Delphi programs contain various resources - bitmaps, icons, cursors, and form descriptions (dfm files).
|How to implement a linked list using Previous and Next pointers. This includes a comparison with TList and TStringList.
|How to display an hierarchical list of nodes - similar to the directory view in Windows Explorer
|Printing via the TPrinter Canvas -
How to print without using report components
How to fix the DeviceCapabilities error
|Many commands, particularly Windows API commands, require buffers - a memory block of a specified size.
|How to create and/or link Components at runtime
|There are a number of classes that should be instantiated only once and then used globally. For example - a dynamic list, an object to produce log files, the object that provides version info.
|How to obtain the handle of application windows and their controls - buttons and the like.
|Capture a Window Image
|How to capture images from the screen using a windows handle
|Stuff you should add to your application to identify it - icons, version information, copyright info, text shown by Windows
|Configuring the IDE
|Delphi is great ... but the IDE (the user interface) can be improved (a little).
|Various tools you should know about
|How to debug your code
|Read this before upgrading or trying to use 2 versions
at the same time
Info on Delphi 2005 Delphi 2006
|Vista Form Size
|Without these changes, many of the programs I write were unusable in Vista
|Moving from VB to Delphi
|A paper by Borland
|Used to create new pages with the correct header and footer info
Free updated help files can be downloaded from Borland/Inprise. (For Delphi 2 and 4.)
Shortcuts / IDE
Use Ctrl-Shift-Space to list the types of properties that a method expects.
When creating components, Ctrl+Shift+C helps to complete a class. (See Class completion in the help.)
If a property is defined as write-only, Ctrl+Shift+C will automatically add a read directive AFTER the write directive. However, since the compiler requires the read directive to be BEFORE the write directive, you will get a';' expected but identifier 'read' founderror the next time you compile. This is annoying, but at least it throws a warning so that you can delete the reads you really don't want ... assuming you know that this is what is happening.
Use Ctrl-J to display the list of defined code templates.
Use Ctrl-Shift-UpArrow (or Ctrl-Shift-DownArrow) to toggle between the implementation and interface sections. For example, place the mouse cursor on a method prototype in the class definition and press Ctrl-Shift-UpArrow to see the code that implements that method.
Use Ctrl-UpArrow and Ctrl-DownArrow to scroll your code. Sometimes, this is easier than using the mouse and scroll bar.
List of keyboard shortcuts
In order to re-name a unit, you must change the filename AND change the name in the first line of the file
unit Filename;and make the associated changes to *.dpr (the project file).
The easiest way to do this is to use File / Save As. However, it leaves the old copy of your files on the drive.
Files related to a unit - pas (code in ASCII), dfm (form), dcu (Delphi Compiled Unit)
The "uses" Clause
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;On my system, each of these has a dcu (Delphi compiled unit) file in
When you write your own component, you include it by adding the name of the dcu file to the uses classes. Then you have to tell Delphi where to find it. From the menu, select
Project / Options... / Directoriesand edit Search Path as appropriate. (I don't suggest placing your dcu's in Delphi5\Lib. Use your own directory.)
The other technique is to place your components in packages and install them.
Setting Font Colors
UIRichEdit.SelAttributes.color := clGreen;It is also possible to paint directly to any component based on TCanvas.
Canvas.TextOut(20, 20, 'Output Text');
ScrollBar1.Max := 1000; ScrollBar1.Min := 500; ScrollBar1.Position := 750;
Clipbrd.dcu 8 Kb Windows.dcu 320 Kb Messages.dcu 19 Kb Classes.dcu 81 Kb Graphics.dcu 64 KbCopy to Clipboard
|Button on Form
When opening the exact same source files on two different machines, I noticed that the size of the form with respect to the components on it was significantly different.
This does not happen when the left button is pressed, just with the right button. With the left mouse button, it does not matter where the mouse is pointing when the button is released, it still calls the mouse up event for the same control where the mouse down was called.
When the left button is pressed, the following are set FState := bsDown; FDragging := True;Without re-writing the control, there is no way to set these 2 parameters when the right mouse button is pressed.
Since MouseDown calls Inherited MouseDown, which calls OnMouseDown, I even tried modifying the passed Button parameter - no effect. It appears to be passed by value, not by reference (ie, the value is placed on the stack, not the address).