[ City Zoo |
Tips & Tricks |
Bug List |
Tidbits from Delphi TechForum 95
As presented by Jim Karabatsos
written by Gary McGhee
Here are some notes I took from the 3 day Delphi TechForum in Perth a few
weeks ago. By the way, it was a solid introduction to Delphi and had plenty
of meat for moderately experienced Delphi users as well. Jim obviously knows
his stuff and has used the product quite a bit.
This one is cool. Try :
- a) select a component on a form in Delphi
- b) select Cut from the menu
- c) go to your favourite text editor
- d) select Paste
- e) you now have a textual representation of the component and its
- f) change some of the properties, but be careful that your changes
- g) select the whole text block again
- h) select Cut from the menu
- i) go to Delphi and select Paste
- j) the component now reappears with the changes you made!
To place multiple instances of the same component on a form, hold down
Shift and click on the component palette. Let go of
Shift, then click on the form to place each instance of the
component. Click on the arrow button when you are finished.
Where's the Beep function ? Look up MessageBeep() in the Windows
API online documentation.
The options requestor from the Project Manager lists the forms of your
project. It also allows you to drag them around to change the order of
.DFM files are binary, but can be loaded and viewed in the Delphi
editor as readable text.
Succ() and Pred() give you the next or previous
value in an enumerated list.
A form owns all event handlers of the components on it, and therefore the
default scope is the form (i.e. in code, "Width" means
"form.Width" even in a button's event-handler).
The ampersand '&' in a Caption property causes the following character to
be underlined (usually to indicate a shortcut key).
For button bitmaps, the bottom left pixel's colour is used as the
background key colour.
To create the same event-handler for multiple controls, multi-select them
and create an event-handler as normal.
Speed buttons can work like radio buttons (i.e. allow only one of a group
to be selected at a time).
You can create constant arrays eg. :
const array1 : array [0..1] of string = ('hello','Fred');
Components can create instances of other components at run-time.
Select a component on a form and try different combinations of shift,
control and the arrow keys to select, move and resize.
Borland Pascal allowed you to put initialisation code for a unit between
a begin and the "end." at the end of the unit. This works
in Delphi, but Delphi will put any new code between these two and cause
syntax errors. The answer is to use initialization instead of
Empty event handlers get removed from the code when the project is compiled.
Pascal doesn't have a power function (^ in C). Instead you can use
a^b = Exp(b*Ln(a)).
Some I've learnt elsewhere :
To make the mouse disappear, set the form.cursor to -1.
ChartFX that comes with Delphi IS documented even though the F1 key won't
help you. You have to search for "chart" in the help topic search.
The form.Name property doesn't work. You can take
form.ClassName and remove the leading 'T' if you don't have
multiple instances of the same form.
The online help for the OnCreate event lists order of events for
creating a form in the wrong order. I don't know the correct order for sure,
but its something like : OnCreate, OnShow,
OnActivate, OnPaint. (OnShow and
OnActivate may be reversed).
[ Home Page
| What's New
| About CITY ZOO
| Borland Delphi
| About the Authors
| INDEX ]
Copyright © 1995 Gary McGhee. This is a CITY ZOO production.
Last revised August 29, 1995.