Java example

It took me a long time to work out how to load classes dynamically so I thought it might be nice to have a simple example.

Free Delphi bits

These items may be useful to Delphi programmers. These are 99% home grown routines which I find useful from time to time. It is no skin off my nose if you find them useful also.

These are mostly Delphi 2 .pas,.dfm and .dpr files so you can inspect and tweak. Read the source before using it. My standard is to put curly comments straight after the first line of the procedure body to explain what it does. If there are any text files in the zip files then please read them also.

I use many of these these daily. There are some bits that just suit me fine for reasons too boring to go into and some legacy bits I daren't consign to the bit bucket. If you want to develop them to suit yourself then go ahead. If you find a bug then send me the fix.

There is no charge, no support and no liability accepted.

Form prettifycation - Easy Drag and resize
This is a tiny unit which gives you the ability to drag and resize borderless controls. It is extremely easy to use with one call in .MouseDown and one in .MouseMove.

It can also be used with many common controls on a form as a bonus.

Zip file
2 K
15 Oct 03
Form prettifycation - 3-D effects and skins
This is a unit which allows you to put a raised border round a form to make it look like it is laid on top of the screen. Controls can be sunk or raised. As well as the 3-D effects you can set bitmaps to skin the form surface with. The two together go nicely.

A really cool effect is to use the exact desktop wallpaper so that the form looks like it is made of a clear plastic overlay.

Clear plastic effect Realistic 3 dimensional effect 20 bitmaps included, roll your own
The zip file contains a couple of example projects and source code. One of the examples shows how to move and resize a form which doesn't have borders.

Zip file
403 K
7 Oct 03
Sorts procedure blocks within a unit into alphabetical order. Just a matter of convenience. Collects usage comments into a documentation block. Zip file
6 K
22 Dec 98
This is the collection of all my utility routines including:
  • Printing functions including change paper trays (NOT NT!), wrapping and aligning text, quickly setting font and selecting printer.
  • Encapsulation of database reads that trap null fields and allow the use of "T/F/Y/N" in single character fields as boolean. (So you can SQL on them) I never read a dataset field any other way. It avoids silly invalid variant conversion errors on nulls and doesn't care about different sorts of number field.
  • Message boxes of various sorts
  • Useful string functions: Substitution, chopping, and formatting oddities
  • Miscelaneous file routines and some visual control bits
  • A new date type which allows invalid dates such as Not-a-valid date, Beginning-of-time, 3rd July (ie no year) and so on. This has been designed to work very simply as a three character string and is ideal for database work.
  • Various date routines including checking, enhancing an editbox and converting into the correct format for SQL queries
  • This changes frequently (as I add goodies and walk slap into bugs) so be warned that although most of the code is stable there might be bits that are new or bits that you use in a different way to me and give odd results.
Zip file
46 K
18 Oct 03
Column and table printing package. This is what I use when I want to print columns and tables. I can choose the heading styles, use the space available in different ways and draw all the lines and border quite simply. Zip file
4 K
Requires Useful
Paradox database structure dumper
(1)Dumps database structure of tables to a text file.
(2) Stores SQL queries (useful for e-mailing to clients with odd questions)
(3) Dumps SELECTed data to screen and text file
(4) Works with non SELECT SQL as well
(5) Works with my dates (q.v.)
This is part of the pack that goes out to customers of mine who have SQL/ Paradox databases. Makes support much easier when you can twiddle with odd queries or delete obnoxious data. Works via BDE aliases.
Zip file340 K
18 Oct 03
Simple tokeniser for splitting strings into sub-units.
There is a lot of flexibility in setting the splitter (But not up to regular expression standards!)
Zip file
5 K
Simple program that spots cases where, although you have deleted a unit from a project, it is still referenced somewhere in a uses clause and so remains a part of the compilation! Zip file
33 K
Includes Useful
A small number of functions that make using Tlist safer and simpler Zip file
1 K
I wrote this because I found that I wanted to do things a bit more advanced than an INI file would support. The dictionary stores variants against a keyword, so for example D.setInteger('Height',45) stores an integer under the key 'Height' and TF := D.GetBoolean('DoneThisBefore?') get a previously stored boolean.

An important feature is that it can load and save itself to file efficiently. See MiniIni

Zip file
2 K
requires Lists, Useful and Dataio
This is my own encapsulation of a simplified ini file.
My configuration files are just comments (lots) plus foo=bar type statements so what I wanted was something very simple that I could just open then read/write specified named variables. eg.
mi := TminiIni.create('');
foo := mi.getstr('FOO');;

The above example opens .conf but you can specify a file or a database alias.
Sept '03: Includes Form position/font/colour save/load
March '04: Includes MRU list
Zip file
2 K
6 Mar 04
This is a configuration file wrapper based on TminiIni - ie a fancy ini file

But it provides support for a hierarchical key naming scheme imagine a simpler form of registry in the file of your choice.

Suppose we had a file like this T Kirk
user.1.password=wecomeinpeace Spock
server.mailin= ; incoming mail servers

  • .countkey('server.mailout') --> 0 "does key exist?"
  • .countkey('user') --> 4 "raw count of how many lines start with this key"
  • .countSubKeys('user')-->2 "No of distinct sub-keys"
  • .listSubKeys('user') --> '1|2' string of keys split by vertical bar
  • .subTree('user') --> string list of everything starting with 'user' with user key stripped off
Zip file
2 K
18 Oct 03
This can be used to perform the same function as an ini file but supports variant values and encryption. For example it can be used to save memo.text values next to booleans. Zip file
2 K
Requires Useful
Hacked code and a bit of explanation to deal with mysterious problems when printing in NT or across a network of mixed OS. What we need is an explanation from Borland why they are SO UNHELPFUL about fixing these obvious bugs. Zip file
19 K
This is a one-stop call which creates and mainatains an aged chain of backup files.

For example to create a daily, weekly and monthly backup a single call with parameters of [1,7,31] would do the trick. This is sometimes called the Tower of Hanoi method and is useful when you want to have frequent copies of fresh data but only a few copies of ancient data.

Zip file
3 K
18 Oct 03
Very simple encapsulation of Textfile for input. Knows what line it is on and can report sensible error messages. Zip file
1 K
18 Oct 03
Message dialog boxes
Unit and package Combined with below
I have combined an OK box, an Alert box, a yes/no dialog and an input dialog into a single unit and added the features I use all the time.
  • Blurb is under the programmers control with sensible box resizing.
  • Optional help button
  • Yes/No button captions can be adapted to suit with buttons enlarged to suit
  • OK box is plain white while the alert box flashes yellow/white. (I reserve alerts for out of the ordinary events which may mean a support call. OK serves for "operation completed" and "operation failed")
  • Plug-in replacements for inputbox and inputquery
  • Inputs extended with validation for strings (including pick from a list), integer,float and date with variations such as Positive-integer or Date-in-past.
This is a recent addition so may get changed and ahem, bugs fixed
Zip file 18 K
Check-list dialog boxes
Unit and package Combined with above
You can operate this in three modes:
  • Pick one accepts first selection
  • Pick some waits for user to OK zero or more selected items
  • Check all normally only returns when all are ticked
There are options to show or hide buttons and display well formatted messages.
This is a recent addition so may get changed and ahem, bugs fixed
Zip file 18 K
I often want to incorporate being able to print a customer's own letterhead into an application. In the past I did this by coding the bits I wanted but now I've packaged it all into an object which reads a configuration file.

In the configuration you specify the bitmaps (it doesn't scale bitmaps but it will sort out different bitmaps for different printers) texts and other rectangular areas (in which you'll be putting something later under program control). By creating the letterhead object you'll select the printer and be ready to print the complete letterhead or programatically select the elements to print. After that you've got access to the text areas which you might use for printing addresses into window envelopes and the dimensions of the space you've left for printing the actual content.

This is a recent addition so may get changed and ahem, bugs fixed

Zip file.
Requires useful and miniini
10 K

Site contents ©