HOME
Or mayve try: http://www.arunet.co.uk/tkboyd/prgmr1.htm: An old page of other material for programmers. I haven't made this a link, because you have to use http, and not everyone wants to do that.
There used to be many translations here. Unfortunately, the translators cheated... initially, the links in the translations took users directly to the relevant page, as required by the license to translate. Then they changed the links, to pull traffic to their sites, hurting my SEO status.
This page, as it stood 10 Jun 24, was available in Norwegian. Alas, wicked people had altered the contents of that page for unwelcome purposes. My thanks to the kind person who brought this to my attention. Happily, we now have Google Translate to make things readily available in multiple languages. I hope it produces a good result for you.
My thanks to the helpful people who created genuine translations, in the "olden days."
Delphi Programming: Tutorials and "How To"s
Most of what is on this page is equally applicable to Lazarus
File: Tut.htm
Suggestion: Your browser has a "Find in this page" tool... probably worth using, if you are looking for something specific.
The following search tool will search this site, not just this page.
Looking for help with how to do specific
things in Delphi, Pascal or Lazarus? You've got the right site! Feel free to use these tutorials in programming courses, but a credit of the source would be appreciated. Speaking of which... the following was a great help to my own programming: 'Borland Delphi How-To', from the Waite Group, by Frerking, Wallace and Niddery, ISBN 1-57169-019-0. Its approach suited my needs, and helped inspire the form of these tutorials: Most are self-contained explanations of how to accomplish a specific task, or use a particular component of the language.
First catch your Lazarus... or Delphi! I now prefer Lazarus, because it is free and creates applications for multiple platforms. I have yet to encounter something Lazarus can't do that Delphi could. Lazarus has been my main programming language since July 2011. Obtaining a copy of Delphi is not as easy as it once was, but I hope you can still do it, if you want to explore an alternative to Lazarus.
Lazarus- All I use now, except to maintain legacy apps
Lazarus is very like the older, commercial RAD, Delphi. You can work in Windows, in Linux or Mac OS. You can compile your code to create applications for Windows, Linux or Mac. And yes, in general, you may sell the code thus created. (See the Lazarus site for "fine print" about that.)
For some years now, all of my new work has been done with Lazarus. Many of the things explained on my Delphi pages "work" under Lazarus. In addition, I have some Lazarus tutorials for you. (They arose after I moved from Delphi. I haven't written a new Dlephi tutorial for some time. (But I still "maintian" the old ones.))
I've begun working thorough my Delphi tutorials, annotating them with indications of anything that isn't quite the same in Lazarus. If you are trying to do Lazarus with one of my Delphi tutorials, and it isn't going well, please write and tell me which tutorial you are working with.... I'll move it up my "add comments to this one" list! I've also started some Lazarus specific tutorials.
Brower-friendly web-pages
I aim to make my pages browser friendly. Make your browser window as wide as you want it. The text will flow nicely. It is easier to read in a narrow window... and the rest of your screen will be free for your Delphi or Lazarus work! Hold down the control key ("ctrl") and press the plus sign, the minus sign, or zero to change the size of the text in Firefox and other good browsers. This and another good hint explained on my Power Browsing page!
There are more notes at the bottom of the page about other offerings, my editorial philosophy, a button to email me, and a search engine to help you find things in my site.
For a bit of fun, see my demonstration of Writing Delphi- like applications with nothing more than Open Office! (I have since moved to the similar Libre Office! The same things work there, I believe.
Forgive a little impertinence? You came here, I hope, for Lazarus, Delphi or Pascal tutorials. Just before you go on to them, I invite you to consider some pages I've produced in an attempt to persuade you that the free, multi-platform database built into Libre Office, called "Base", is worthy of your consideration. (Essy was written a while ago while I was using Open Office... a very similar project to my current favorite, Libre Office.
See Also: Lazarus / Delphi Course:
Further to my longstanding Delphi tutorials (Table of Contents follows), I have a series of essays which will help you become a good Lazarus/ Delphi programmer if you take the time to work your way through them. The Tutorials can be tackled in whatever sequence suits you. The essays of the Lazarus/ Delphi Course are most useful if read in sequence. Lazarus/ Delphi Course Table of Contents
Table of Contents, Delphi and Pascal
Tutorials/ "How To"s.
(Also relevant to Lazarus programmers)
Delphi.....
Level Zero:
Pascal course: If you are not only new to Delphi, but also new to programming, you might want to study Pascal a little first! There is a free product, Pascalite, which you could use for that. What you learn with it will all contribute to getting going easily with Delphi. Working with Pascal first lets you master one group of issues (which will matter in Delphi programming, too) before you contend with them AND some issues that are involved with any Windows language. The page about my course also tells you how (6/2007) to obtain the excellent Borland Turbo Pascal, too, which will suit some needs.
Want a bit of fun? If you have the excellent, free, Libre Office installed on your Windows or Linux machine, you can write applications similar to many of the applications in this tutorial! I've produced a little demo, consisting of a single "document" for Libre Office's wordprocessor, "Writer". If you have Libre Office on your machine, and download my demonstration, you will see a "page" of "wordprocessor" material with a button, an edit box, two spin boxes, and some labels, for output. You will see text manipulation, message boxes, and arithmetic. Almost like something created with Delphi! Fun! (The details of how the controls were made "live" are also given.)(The demo was written for Open Office version 2. I believe the same things were possible in version 1, and are also possible in Libre Office.)
Level 1 Tutorials:
First Class Start Here: But don't be surprised to find yourself at a Lazarus tutorial! At this level, Delphi and Lazarus are almost indistinguishable. This Lazarus tutorial was written in July 2011, long after my Delphi tutorial site was mature. The Delphi "Start here" was written before I knew what I know now!
Continue here But, again, don't be surprised to find yourself at a Lazarus tutorial! As was the case with the previous tutorial, this Lazarus tutorial was written in July 2011, long after my Delphi tutorial site was mature. The Delphi beginners' tutorials were written before I knew what I know now!
(At the moment, there is also some Level 1 stuff in the Level 2 tutorial called 'Adding things to a unit')
Second class "Start Here" This takes a complete beginner
through a first project, covers points that apply to any project, and
covers some points about conventions used in the other tutorials.
The Whole Picture An overview of the parts of any Delphi project.
This is more 'philosophical', less 'how to', than most of my tutorials.
Subroutines: Procedures and Functions. Essential building blocks. This is an important tutorial, and written in May 2007, when I am past making some of the mistakes present in earlier tutorials!
Making it work: Tips and advice on debugging.
Also more 'philosophical', less 'how to', than most of my tutorials. (See also the Pascal debugging information in the Pascal section below.)
The edit box OnChange event handler: Don't be alarmed if you use this link and find yourself in Lazarus- land. Unless I am very much mistaken, what you see in the tutorial will work just as well in Delphi, and help you understand events and event handling.
If you can't find what you want here, remember: I have more tutorials in my collection of Lazarus tutorials. What they say may well apply equally to Delphi.
Level 2 Tutorials:
How to..... Make a 'beep' or other noise.
How to..... Blank the monitor by turning it off.
How to..... React to user's mouse actions.
____________________________________
SPECIAL ! > > > Read this one when you have become comfortable with making Delphi work, at least for producing little things. It is a tutorial explaining a way to stay in charge of the application you are developing. It presents "flow charting" for event driven environments: State Diagrams. Has sourcecode. Covers important general skills that will let you progress to making things by design instead of by "poke and hope". Those skills allow you to complete bigger, more reliable, projects. Along the way, a drill and practice application is developed which could easily be extended into something useful.
___________________________________
And now the "ordinary" Level 2 tutorials....
Try this one... I wrote this in May 2011... after MANY years of using Delphi, and of writing these tutorials. Were my early tutorials "perfect"? No! And I will try to edit them one day, clean up the bits of things I later learnt were not so clever. This tutorial tells you how to do something... I'll get to that... but it also has some important general tips on using Delphi, and on programming in general. The subject of the tutorial is creating a little application which presents randomly selected quotes from a text file of quotations. The tutorial comes with full source code, a copy of the finished .exe file, and even a sample set of quotations to use. (These are in a .zip archive, and the download link is in the tutorial.)
Keeping the customer satisfied... How your program can determine your user's wishes (Pt 1. See also Pt 2, in level 3). This tutorial comes "recommended": check it out, please, even if determining user's wishes wasn't the main thing you were looking for?
Menu, "About" page and Quit option in menu... How to add them to a project.
Data File Handling... reading/ writing data files, with sourcecode. First part. When you are happy with the material in this tutorial, there is an extension of it in Level 3. Atypical of tutorials here in that it leans toward a discussion of a finished product more than showing you the construction from the ground up.
File Handling... How to read data from files on disc, and write to such files. (A long tutorial)
Re-using a project... A short guide to building a new project from an earlier, similar, one.
Adding Things To A Unit... Where put things. Things that matter. Matters of scope.
This tutorial is full of Good Stuff... but very untidy, badly organized at the moment. I will try to sort it out, but for now: You have been warned!
Syntax Notation... how to read important stuff.
You will learn more from the Borland "Help" files once you master the information in this tutorial.
State Diagrams... I recommend you read this short general note on using state diagrams. They help you keep a clear idea of what you're trying to create. Flowcharts are good for small "corners" of your project, but since Windows (and Linux) are event driven, flowcharts are limited in their usefulness for managing the overall picture.
A Complete Example... This was written in May 2007, and is more polished than some of these tutorials. It gets off to a slow start, but once it is underway, it takes you quite quickly through the creation of something bigger than a typical Level Two application. What it does is not the main point... The main point is how the application was built, from empty form, thought stages, to finished creation. The application manipulates character strings.
Command Line Parameters... PLEASE have a look at this... it is quite short. You will be shown a way to achieve some of the benefits of .ini files and the registry... without presuming to write things onto your customer's systems.
Using the TTimer component... This not only gets you started with using an important component, but it should also help you extend your skills for working with Windows' fundamental event driven nature.This tutorial was heavily edited 5/07 and a) is polished and b) covers some essential aspects of writing Delphi programs. It isn't easy or short, but it is highly recommended if you are willing to make an effort to make progress! It isn't just about the Timer component.
An example- Reading Skill Exerciser... This comes with complete sourcecode for you to peruse. It illustrates using the OnChange event of an edit box to respond to user input. It also uses a timer to display a list of words on the screen for a time-limited reading opportunity. The use of simple Try... Except blocks is also shown, in the handling of an EConvertError exception.
Principles of programming, and Scrollbars, GetTickCount, etc... This also comes with complete sourcecode for you to peruse. It shows ScrollBars in action, but it also "digresses" to cover a number of general points like nesting procedure (or function) declarations, using TabOrder, and setting up enables. The useful GetTickCount gets a mention, too.
Use the events, Luke... This tutorial started as an introduction to string grids, and it does introduce them. However, while I was working on it, I "discovered" more than I'd known about using an event driven operating system. The tutorial also illustrates well good incremental development. Recommended to everyone, not just those looking for help with string grids. Not terribly long. It also leads on to an even more important Level 3 tutorial.
If you can't find what you want here, remember: I have more tutorials in my collection of Lazarus tutorials. What they say may well apply equally to Delphi.
Level 3 Tutorials:
Quite a few of the things assigned to this level are not complex, but they were put here anyway as they were not essential to Delphi programming in general. Some others are also pretty simple, but come without much supporting tutorial material.
Getting your application to automatically copy text to the system clipboard or paste things into your application from the clipboard: An unusually brief tutorial... but "it does what it says on the tin", and the techniques are useful. This is in level 3 only because those techniques aren't broadly important, and also the tutorial has been written for readers who are not new to Delphi. The tutorial is actually from my Lazarus tutorials collection, but I believe everything in it works the same way in Delphi... but must admit that I have not tested that! Do write and complain if I am wrong; save the next person the hassle?
Using Ini files, the printer, how events help, checksum data validation, and various "basics" An unusual tutorial. A large(-ish) "real" application, which I wrote because I needed it, not because it was useful for illustrating some programming skill. The tutorial has much more in it than some, with much less explanation. Almost none of the usual blow- by- blow description of the bottom up development, for instance.
Also, it is a first! It is about a program written using Lazarus! I think everything in the tutorial applies equally well to Delphi work. Previously (before September 2012), I did a few conversions of Delphi tutorials to make them "work" with Lazarus. (Not much "converting" needed, as a rule.) Here, for the first time, a program that was created using Lazarus, but which has lessons for the Delphi programmer.
Passing data to and from subroutines. External units. Using user defined records, to "pack" a number of values into one "parcel". With an extension about how code can be put in standalone external units, for re-use between multiple projects. (No... I don't mean making a component... something simpler, with fewer ramifications. Written in May 2011, and more concise, more valuable than many, if you need the skills explained. You "can do without" them.. but if you start to use the techniques explained here, your programming can become more robust, and you may finish projects more quickly.
Wax on, wax off... A simple application, with sourcecode. Doesn't do anything terribly cleverly, but illustrates how simple and "clean" an application can be. This application was built for an actual, real-world need, connected with my participation in the Thingspeak/ IfTTT/ Pachube "internet of things" data brokering project. But it has other applications, and things to teach even non-Thingspeak/ -Pachube/ -IfTTT users. Written in January 2011, but still (apr 2019) worth at least a skim through, if I do say so myself, even though Pachube is gone!
This one >>> * * I commend to you!... not only for the information on multiple forms, clever use of events to drive state changes, and information on passing controls to parameters, but also because is was written long after most of the material in the site, and covers general points that should help you do a better job of writing applications. (Published 9/06).
Keeping the customer satisfied... How your program can determine your user's wishes (Pt 2. See also Pt 1, in level 2).
Help Files... making the link between them and your program. (A short tutorial). (I use HelpScribble to create my .hlp and .chm files. I have a page reviewing helpfile creation, too.)
Creating an array of Edit Boxes... the
tricks explained here would work with other components, too.
Creating something to be used by many programs... Shows you how to re-use code. Write something once, use it in many applications. The tutorial does not take you all the way to registering a component so that it becomes part of the Delphi Component Palette, but it does show you how to create something which can optimize the development of a number of programs which all need a common element, for example a message box with copyright and version information. There is another tutorial on this important topic in Level Four, where some extra features provided by Delphi are utilized.
Alternate "creating something to be used by many programs"... ^^ See also previous tutorial ^^. This "alternate" is an old tutorial, not as well presented as newer (post about 1/04) ones. It does, however, describe creating a High Score Table. Try to ignore the "to be used by many programs" elements... they are better explained in the previous tutorial, but if a High Scores table is what you need, this is your tutorial!
Yet Another data file handling tutorial There are quite a few on this site! This one is very concise, and newer than most, having been written in July 2011. It uses memos. One to hold a file which is massaged by the program, one as a buffer to build the result in. Also goes into using the OpenDialog and SaveDialog...umm... dialogs! The tutorial may also be used as a helpful shell to break the back of getting many file manipulation applications written. The code is quite "tidy", worth a quick skim for some other "tricks" used along the way.
Data file handling plus using dialogs Reading and writing data to / from files. Second part, although you can start here. (Do start here if the material on dialogs is your only interest.) The first part is in Level 3. Delphi components OpenDialog and SaveDialog explained. (They are Good News, and not too hard.) Also covered: creating your own dialog forms. Source code available for download. Atypical of tutorials here in that it leans toward a discussion of a finished product more than showing you the construction from the ground up.
A quiz program... Illustrates sundry things, uses a TMemo object, shows you how to implement "Do you want to save your data before you exit?" Quiz program remembers users' past performance, on a question by question level. Source code available for download.
Data entry program... probably, in itself, of no use to you. But illustrates some useful tricks, may help improve your grasp of the opportunities which an event driven environment create. Source code available for download.
A start on a typing tutor game... Unfinished at present. Illustrates development of an application.
How to access database files... It is remarkably easy to write a program in Delphi which allows you to view and edit files shared with Paradox, dBase, Access, etc. Learn how here!
Playing .WAV files with MediaPlayer... Whether you want your program to SAY "You have new mail...", or just need a superior "Zapp!" sound, here's how. And what you learn here probably works for playing other media, too.
Reading the joystick... doing it in Delphi 2 and above. Revised and expanded May 04. A stopwatch program is created as an illustration. See also the level 4 joystick tutorial. Sourcecode supplied.
A control program dissected... A program with checkboxes and boolean variables working together is analyzed. Downloadable sourcecode supplied.
Using DLLs. Introduction... How to use functions and procedures from someone else's dynamic link library (DLL). One is provided. There is also an optional second section about how to write your own DLL. The tutorial comes with sourcecode, and a pre-written DLL for you to use while you learn. See also my level 4 tutorial if you want more on DLLs.
Printing- a line at a time... this tutorial shows you how to send text to a printer a line at a time. There are no complex concepts, but the need isn't universal, and the help is minimal.-->
A Word Search Program... You won't need the program, but maybe some of the techniques used to complete it will be of interest! Sourcecode and .exe provided. Little hand-holding regarding how to make Delphi work, just comments on and in the finished product.
Pick a cell, any cell... Ostensibly, this tutorial is about using code to select a cell of a string grid at run time. Along the way, some more generally important material arises concerning using references to Delphi created objects, e.g. the object in "sender" arising from Delphi created event handlers.
If you can't find what you want here, remember: I have more tutorials in my collection of Lazarus tutorials. What they say may well apply equally to Delphi.
---------
Drawing or viewing pictures/ graphics, ETCETERA: Just to help you find things, I'm grouping (*) the following Level Three tutorials together. While a part of each of these is about drawing pictures, doing graphics with Delphi, almost all of them cover other topics, points, issues along the way....
Introduction to Graphics... MoveTo(100,10);DrawTo(300,300); is simple enough... The link at the start of this paragraph will take you to a Lazarus tutorial I wrote at Christmas time, 2013. It tells you most of what is in the next, older tutorial, probably better. It contains notes on the very slight differences in what you do in Delphi vs what you do in Lazarus. Try it first. If it doesn't tell you what you need, try...
* Introduction to Graphics... MoveTo(100,10);DrawTo(300,300); seems simple enough... but it isn't enough to make a line which will still be there after you minimize then restore the window. (See the previous entry in this table of contents now.) The link in the paragraph you are reading also tells you how to create persistent graphics, and(!) talks briefly of loading bitmaps.
* Another drawing tutorial, with extra bits!... This is one of my more carefully done tutorials. It was completed in May 2007 when I'd been writing them for some time. It extends the work done in the previous tutorial ("Introduction to Graphics") and also shows you a bit about building easily altered programs. The graphic generated is just a bit of pretty fun poking fun at the people who thought the DRM access code could be kept a secret. There's also a bit about different number bases. ("Hex", etc.)
* Images and File Access... Display .bmp images on your form. Access all the files in a given folder on your disc, using that as the basis for a "Can you recognize..." exercise. Tutorial has rough edges, but full source listing of working program
given. (Delphi versions 4 and 7, at least, allow you to display JPEGs. I don't know which version of Delphi came with this functionality... email me if you do know?... and I'm looking for a freeware component with sourcecode (or from a reputable source, like sourceforge or Tucows) for a component to allow showing JPEGs in Delphi 2 applications... again, please email if you can help? A related thought: Delphi 4 (standard) can be installed on a PC with only the serial number and authorization code. You don't need "permission" from a Borland (or other corporate... e.g. Microsoft(!)) server. Do you really think that Mr. Gate's corporation is going to let you play forever with all the tools they've released "free" recently? (pre-5/07) And will other corporations always be there to re-enable things that you move to new PCs? Give me products that I can install web-less, every time!
* Graphs for mathematics... This comes with sourcecode and a compiled exe. It is a longer- than- usual tutorial because you are taken through the development of an actual, useful application. There are no particularly difficult concepts involved, apart, maybe, from the use of one subroutine to provide the OnChange handler for several edit boxes.
To write a screensaver:A screensaver is not very different from any other Windows application. Mark R Johnson had an excellent discussion at https://www.mindspring.com/~cityzoo/scrnsavr.html in the same style as my tutorials, and I see no reason to re-invent that wheel. (He's even made the source code available.) I've put this in Level Three because of some tedious odds and ends that you must address. What you have your screensaver do can be very simple. I hope you can find the new home of that. (And tell me?)
If, by the way, you are just looking for a screensaver generating program, to display your photos, I've done a comparative review of some things... many free.. that may be of interest.
A favor, please? If you know of a good Windows screensaver which satisfies the following, please let me know? (I only need the .exe, not the source code.)
Shareware, registration less than $20.
Displays rotating cube.
Pictures on face of cube user-defined... hopefully by
some VERY SIMPLE means. Best of all: Screensaver just
uses the six images in a known location. In my perfect
world, changing the contents of one of the files would
change the image on the cube. I don't mind being
restricted to fixed image file names.
Editor's email address. Suggestions welcomed!
My thanks to the kind reader who pointed me to Xara's rotating cube screensaver. It has been running on my machine for a few months now with no problems. It even meets my "Change display by changing file contents" requirement, I think. It shades the faces as they turn... an essential "frill" to achieve best effect, I believe. Info and program at Xara's site.
Level 4 Tutorials:
Biggest and Best to Date: Linking multiple devices Arduino "master/slave" setup: With a program running in a "master" PC, an Arduino "slave", with an LED and "doorbell" switch can be "driven" / monitored. The window on the PC's screen tells you from moment to moment whether the "doorbell" connected to the Arduino is pressed, and there are two buttons: "Turn LED On", "Turn LED Off". With a click of the mouse on the master, the PC, the LED on the Arduino can be turned on or off. The two are connected by a simple serial link. You don't NEED Delphi to benefit from the material in the tutorial, even though the PC part of it is couched in Delphi terms.
Using the serial port...Part One: Sending messages from a PC over a serial link, e.g. RS-232... but only in one direction.
Using the serial port...Part Two: Bidirectional comms, sending messages either way between two devices connected by a serial cable, or virtual serial comms link. This has the elements for a Hyperterminal clone. (See "PuTTY" (use Google) if you want a finished "Hyperterminal".)
Using the serial port... Hyperterminal clone: Not as good as Hyperterminal or PuTTY... I only mention them to give you an idea of what the program does. It sends from a memo, character by character, as fast as you enter them, and receives data via a serial stream, and passes things to a memo. This tutorial is particularly crude at the moment, but does offer you a lot of code. The program is discusses was eventually transformed into the "Biggest and Best", described above.
STOP PRESS!!! I have, after MANY years of trying, finally sussed out the underlying routines for a Hyperterminal clone. The program, sourcecode and compiled exe is available to you in "Using the serial port, Part 2" (above). If you are working with connecting devices with serial links, you may also find my Arduino Serial Comms page useful.
The "try... except..." mechanism for trapping errors This is one of those things that you don't "need"... but it is very useful when you master it. And it gives you a way to control what happens when, for instance, your application encounters a range check error. This essay also goes into a number of issues of Good Programming Practice. It does not, alas perhaps, just "tell you the answer". First draft July 2011, when I had been using Delphi and writing these tutorials for over a decade.
Accessing Port Hardware... this tutorial tells you about a freeware DLL for sending messages to and from your PC via the parallel or serial port. The tutorial includes help on how to use it. You could drive electronics of your own devising attached to your PC. If you are new to DLLs, there is a Level 3 tutorial on DLLs for you. If attaching your own electronics sounds interesting, visit my page on using your computer's ports.
Customizing a standard control... Complete
the Level 3 tutorial 'Creating an array of Edit Boxes' before
attempting this one.
File Modification... Not complex, but presented assuming some fluency on part of pupil. Replaces a file with a modified version of itself. Backs up original file.
A worked example... A program for decoding simple substitution codes. This builds on the previous tutorial.
Navigating backing store... Re-creates parts of the Windows Explorer. Also illustrates multiple windows. Uses FileListBox, DirectoryListBox and DriveComboBox.
Using units... This was written in May 2007, so has some advantages over older tutorials. It does tackle a fairly complex topic, but a very useful one: Putting subroutines in units which can be used and re-used. In this tutorial, we go farther than we did in the earlier one on the same topic. Commended... if you are feeling up for a challenge!
Color Graphics. Dynamic resizing... How to draw in the color of your choice. How to make things on your form change size if the window's size is changed.
HTML generator... the beginnings of a program to generate online photo albums.
Angle display... a small circle with an arrow in it. The arrow can point any one of 16 directions. Originally developed to show the direction a wind vane was pointing. No "crucial" skills in this tutorial... but it is a good one, with some nice bits of elegance in the coding. Some intermediate event handler techniques illustrated. It also illustrates a use of the tag property.
Another worked example... This is bigger and moves along faster than some of my tutorials. It shows how I extracted data for a given day from a bunch of files, each holding records for many days.
Windows messages, joysticks and a stopwatch... This covers several topics, including responding to messages generated elsewhere within the computer, messages from a Windows API. There's a simpler way to read joysticks explained in a Level 3 tutorial. It comes with sourcecode.
How to ensure that... only one instance of an application runs at any given time. Uses mutex.
External units... an easy way to recycle code you have written without the overheads of custom components.
DDE Client... A limited introduction to collecting data from a DDE server, using a 1-Wire/ MicroLan example.
Transforming strings... Two functions. The first takes strings containing ambiguous characters... like "0". Is that zero or "oh".... and converts them to strings with no ambiguous characters. The second reverses the process. Useful if you are going, for instance, to give users registration key strings. The tutorial also introduces some concepts which are of general use to programmers.
If you can't find what you want here, remember: I have more tutorials in my collection of Lazarus tutorials. What they say may well apply equally to Delphi.
Level 5 Tutorials:
Getting started with TCP/IP There is a lot to master before you'll be an expert at fetching things across the LAN or via the internet, using TCP/IP. However, if you just want to fetch a file, be it some HTML, a jpg, or some data in a file on a web server, and you can adapt someone else's program, even if you don't understand everything that it is doing, you may only need WinHTTP from https://appcontrols.com/, and the little demo program that comes with it. It is available as shareware (try before you buy). It works with MANY Delphis, and maybe even Lazarus. The demo should be enough for you to write a program to, for instance, fetch and store images from an IPCam. A "without sourcecode" copy only costs about $18. If that doesn't meet your wants, try the next tutorial...
An older "Getting started with TCP/IP" There is a lot to master before you will succeed in communicating between machines on a LAN, let alone across the internet. This tutorial, which comes with complete sourcecode, looks at some fundamentals. Along the way, it creates a small client application. At the end of September 2011, it is perhaps my best tutorial on TCP/IP issues... The best one to start with, anyway.
The internet, and beyond! You can write applications which access pages across your LAN or the internet! This tutorial gives you an entryway into the world of TCP/IP. Specifically, it tell you how to create an application which can look at, say, https://bbc.co.uk, and transfer the HTML from that site into a TMemo component inside your application. That's the hard part! What you then do with that is up to you.... I trust you see the many opportunities this opens up? (See also next tutorial.
TCP/IP: The issue of "blocking" Before you can get far with the ICS, and TCP/IP programming, even with the help of the previous tutorial, you need to begin to master the skill of programming in a way that is non-blocking. Your TCP/IP stuff really ought to be done to allow asynchronous communications across the internet. This tutorial tries to help you with those concepts.
A minor adaptation of an ICS demo In this tutorial, we slightly adapt a basic demo from the collection supplied with Francois Piette's Internet Component Suite. The object is to begin understanding the components and TCP/IP programming. The adaptation may be minor, but if you are new to TCP/IP, I think you really ought to have a go at this tutorial.
Sit at my elbow... while I write a program that is bigger than a typical Tutorial program. Sourcecode available for download. Illustrates the development sequence. Illustrates some file handling and graphics programming.
Temperature logger... Logging and graphing data from temperature (and humidity) sensors. Comes with sourcecode. Tutorial also covers fetching XML from a webserver, as it was written in connection with the Poseidon SNMP / XML LAN / internet "thermometer" (from HW group), but it can be revised to read from other sensors. (Delphi 2, plus a free third party component, ICS. This is client/ server work.)
RS-232 comms (serial i/o)...OBSOLETE: There is a better tutorial ("...Part One") along these lines above... but I am leaving this here as a secondary resource for you, if you don't like the other. A start on a home-brew simple Hyperterminal. Can send only, so far, but doesn't require any third party components. (Delphi 2)
RS-232 comms (serial i/o) for data log devices...OBSOLETE: There is a better tutorial ("...Part Two") along these lines above... but I am leaving this here as a secondary resource for you, if you don't like the other. A simple Hyperterminal-like terminal program, configured to interact with either of two data collection devices (Anderson TM#128 / WeatherDuck). It could be adapted for other environments. The program has some flaws, but "works". Uses the freeware, with sourcecode, component TComPost from Dirk Claessens. (Delphi 2)
Differential Thermostat...A pretty "rough" "tutorial", as I suspect a limited audience... but may be useful to some! Comes with sourcecode. See Temperature Logger, above, for how to fetch XML from a webserver... the code in that is better. Written in connection with the Poseidon SNMP / XML LAN / internet "thermometer" (from HW group), but it can be revised to read from other sensors. Uses SNMP to turn on / off an output on a LAN attached device. (Delphi 2)
-------------------
My tutorials about programming for the Dallas Semiconductor 1-Wire chips, as used on a MicroLan (tm), have been moved to here.. I also maintain pages which introduce MicroLan and explain the hardware.
-------------------
Pascal
.......
(If you are interested in seeing links to others' work, bookmark this page so you can get back to it, and visit my page with links. Of course, almost everything that anyone ever wanted to know is already on the web in Prof. Salmi's superb FAQs.... if you can find them!!! These wonderful resources are worth seeking out. 1/2009, they were available https://garbo.uwasa.fi/pc/ts.html, but don't seem to be there now. Can you find them? Tell me where they are? It used to be that you had to fetch tsfaqp50.zip, unzip it, look in TSFAQP.IDX for the FAQ's table of contents.
(Those FAQs seem to move around! There were at ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip, and then at ftp://garbo.uwasa.fi/pc/ts/tsfaqp36.zip. Hiding again? Try searching with Google for "timo salmi pascal faqs". I'm thankful they weren't written by Joe Smith!
At one time, I had to ask "Don't know how to unzip?" And said "Time to learn!" I hope you have no trouble with .zip archives today?
If what you want to know isn't answered in my pages (!), then you could use newsgroups or forums. One way to find a group is Google's Groups Service.
Pascal Tutorials:
Pascal for those who know Basic... Some notes from me for those who know Basic, and who haven't done much Pascal.
Making it work... Help with debugging.. and on preventing the need for it.. Also useful to Delphi programmers.
If you can't find what you want here, remember: I have more tutorials in my collection of Lazarus tutorials. What they say may well apply equally to Delphi.
Editorial Philosophy
I dislike 'fancy' websites with more concern for a flashy
appearance than for good content. For a pretty picture, I can go to an art gallery. Of course, an attractive site WITH content deserves praise... as long as that pretty face doesn't cost download time. In any case....
I am trying to present this material in a format which makes it easy for you to USE it. There are two aspects to that: The way it is split up, and the way it is posted.
The way it is split up...
I have tried to split it up into 'bite-sized' pieces, and to indicate which pieces are basic and of general importance, and which address more specific issues which also happen to be complex, or require understanding of more fundamental issues. In other words, I try to show you how to walk before worrying about running. The 'Level 1' tutorials cover the basics. If you have no experience, start with the level one tutorials. If you decide to jump in at a more advanced level, and things are not clear, it might be an idea to skim the level one topics if only to learn about my way of expressing the concepts. See also, below, the 'difference' between Delphi and Pascal.
The way it is posted...
This archive of tutorials stretches back some way towards the dawn of the internet. Now, most of us have HTML capable wordprocessors, and newer tutorials make more use of HTML code than older ones. Is this a problem? You could save the pages from a browser, and re-load them to the browser from your hard-disc later, off-line. LibreOffice (the excellent, FREE, office suite for Windows AND Linux from www.libreoffice.org) takes HTML in its stride. With WordPerfect, you can load the .htm file, select all, copy to clipboard, start a new WordPerfect document, then paste in the text, mostly intact and cleansed of HTML.
You should be able to read the tutorials on-line without difficulty. However, you should ALSO find it easy to capture them for off line use, including editing for your own purposes. The following should work. I would suggest that you create a folder for the tutorials so that you can retain my filenames with no risk of clashes:
Note that if you work from off-line copies, you will miss out when there are updates, revisions.
On-line, use your browser to view the tutorial you want to capture.
Use the browser's File|Save As... to save the web-page to your disc. At this point you can log off, or visit other pages, perhaps saving them, too.
When you have logged off, just use your browser's File ! Load command to view the material. If you want to edit the files, try using your usual wordprocessor. Failing that, start Notepad (or Wordpad, or anything you like, but then you're on your own <g>). Load the file you saved. Turn word-wrap on. (Notepad: Edit|Word-wrap.)
Snip off the html header and footer. Re-save the document, changing the extension to .txt or .doc Depending on the tutorial, there will be more or less HTML code within the body of the text. With luck, your wordprocessor will cope with this. Give LibreOffice a try if not! Otherwise you can use global search and replaces to remove most of the tags fairly quickly.
________
This would seem to be the place for a plug for Textpad. It is much more than Notepad, while not being all that a "wordprocessor" is... but it DOES have features that you will soon come to love, if you do much work with text files.... especially programming or HTML coding. All of my web pages are created with it, and much of the other text work I do is done with it, too. It has a spell check. It has syntax highlighting. I turn to my wordprocessors (Ami Pro, for legacy work, and, for a while, OpenOffice Writer, and now, LibreOffice Writer for new work) only when I want to produce a letter- formatting and font options are not extensively supported in TextPad. However, it does have many, many, very neat touches which make it a joy to use for many things. I particularly like their answer to "autotext", and the fact that the user can configure how it displays different classes of documents. Here is a link to their site. Shareware: You can try it for free, and it is not expensive to register for continued use.
________
Filenames: I've tried to be organized: Names start Pt or Dt for Pascal/ Delphi Tutorial. Next is a digit, for the level, then I've used letters one after the other, e.g. Dt1a, Dt1b, Dt1c. The letter doesn't mean much... it just shows when I got around to that particular topic! DST files are some of those relating to the Dallas MicroLan.
Please remember the material is copyright. (TK Boyd, 2006 and later) The procedures above are suggested only for convenient personal use of the material, however, also....
Feel free to use this information in computer courses, etc, but a credit of the source, quoting the URL, would be appreciated. If you simply copy the pages to other web pages you will do your readers a disservice: Your copies won't stay current. Far better to link to these pages, and then your readers see up-to-date versions. For those who care- thank you- I have posted a page with more information on what copyright waivers I extend, and suggestions for those who wish to put this material on CDs, etc. (There is at least one prison using the material for inmate education. I do understand that situations exist where an internet connection isn't possible!)
The difference between Delphi and Pascal... and the promise of Kylix or Lazarus....
Delphi is based on Pascal. It is for writing programs for Windows, using Pascal.. with a lot of enhancements from those once wonderful people at Borland. Once upon a time, my advice was "if you are very new to programming, you might make progress faster if you start with a non-Windows Pascal."
However, because Windows, Linux and MacOS use a GUI, and because the GUI environment is important, and non GUI programming is done from a different perspective, I think, today, I would say, no... start as you mean to go on. Start with Delphi or Lazarus, even though, in some ways, it means you have to start at a more complex level.
If you want to try a non-GUI Pascal, there were free ones around. Details of one was in my free Pascal tutorials, but I don't know if it remains available.
In the Delphi tutorials here, you should find all you need for Delphi programming. However, even if you never intend to program for anything other than Windows, if you are new to programming, looking at some of the low level Pascal tutorials might help you to grasp important ideas for your Delphi work.
(This note added May 2007, revised 2015) Kylix was a product Borland brought out years before 2007. I never "played" with it, but it was, I think, a "Delphi for Linux". Sadly, as far as I know, Kylix died. Happily, though, we have Lazarus which fills the wants Kylix was aimed at.
Site Map
What's New
Search
The search engine is not intelligent. It merely seeks the words you specify. It will not do anything sensible with "What does the 'could not compile' error mean?" It will just return references to pages with "what", "does", "could", "not".... etc.
If you can't find what you want here, remember: I have more tutorials in my collection of Lazarus tutorials. What they say may well apply equally to Delphi.
In addition to the tutorials for which this page serves as Table of Contents, I have other sites with material you might find useful.....
Tutorials about the free database supplied with Libre Office. (Many were written when I was using Open Office. They remain valid, mostly, for Libre Office. Please alert me to any exceptions, so I can spare the next reader?
Some pages for programmers.
Using the parallel port with programs written in Delphi.
Links to other peoples' pages you may find useful
For you! A short list of other Delphi and Pascal sites which I have personally visited and like.
Please visit the following to help make my site better known...
If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.
Learn more about 1&1 Web Hosting
Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here
to visit editor's Sheepdog Software freeware, shareware pages.
And if you liked that, or want different things, here are some more pages from the editor of these tutorials....
Click here
to visit the homepage of Sheepdogsoftware.co.uk. Apologies if the "?FrmTut" I added to that link cause your browser problems. Please let me know, if so?
Click here
to visit editor's pages about using computers in Sensing and Control, e.g. weather logging.
To email this page's editor, Tom Boyd....
Editor's email address. Suggestions welcome!
Page has been tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes.
AND passes...
Why does this page cause a script to run? Because of the Google panels, the code for the search button, etc. Why do I mention scripts? Be sure you know all you need to about spyware.
....... P a g e . . . E n d s .....