Delphi Cookbook – 2nd Edition

This book the 2nd edition of the Delphi Cookbook serie. In 470 pages you will find useful (I hope) “recipes” for your day-by-day Delphi job.

The first edition got a lot of interest and appreciation comments. Delphi Cookbook has been a best sellers for PacktPub (the editor) in its category, so the editor decided to ask me a 2nd edition. So here it is!

What’s new

The problem with each “2nd” edition is: “What I can expect if I already bought the 1st one?”. This edition contains all the recipes from the 1st edition updated to the new Delphi 10.1 Berlin, plus a lot (ca 150 pages) of brand new contents. There is also a brand new chapter about less-known RTL classes. Also some “old” recipes has been completely rewritten because some techniques has been superseded by the newer Delphi versions. So, if you liked the 1st edition, you will find a lot of interesting things also in the 2nd one. The 2nd edition contains 470 pages compared to the 328 of the 1st edition.

Topics of the book

  • Understand the basics of professionals Delphi programming
  • Become a Delphi language Ninja
  • Knowing the new RTL classes to work with HTTP/S, Net encodings, event bus, compression etc.
  • Develop visually stunning applications using FireMonkey
  • Deploy LiveBinding effectively with the right OOP approach
  • The thousand faces of multithreading: syncronization tecniques in the real world
  • The Parallel Programming Library: Tasks, Futures parallel For
  • Create server-side programs to serve RESTful web services and provide data to your mobile apps
  • Use well-defined GUI design patterns to build mobile applications that provide a great user experience
  • Build mobile apps that read data from a remote server efficiently
  • Using sensors and network in mobile apps
  • Call the platform native API on Android and iOS even for an unpublished API
  • Manage software customization for your customer by making better use of an extended RTTI
  • Implement the most popular design pattern without wasting too much time on debugging and bug fixing

It is not an introductory book, you will not find any “Introduction to the Object Pascal language”, however the majority of the chapters are not too complex and can be grasped also by the new Delphi programmers.

Where to buy

The book is available for sale on the editor website and on Amazon.

PacktPub (Official book page)


Delphi Cookbook 2nd Edition on Amazon


Table of contents


  • Change your application look&feel with VCL styles and no code
  • Changing the style of your application at run time
  • Customizing TDBGrid
  • Using owner draw combos and listboxes
  • How to make an owner draw control aware of the VCL styles
  • Creating a stack of embedded forms
  • Manipulating JSON
  • Manipulating and transform XML documents
  • I/O in the 21th century: knowing the streams
  • Creating a Windows service
  • Associating a file extension with your application on Windows
  • Be coerent with the Windows look&feel using TTaskDialog


  • Fun with anonimous methods – using higher-Order functions
  • Writing enumerable types
  • RTTI to the rescue – configuring your class at runtime
  • Duck typing using RTTI
  • Creating helpers for your classes


  • Check strings with regular expressions
  • Consuming RESTful services using native HTTP(S) client libraries
  • Cope with the encoded Internet world using System.NetEncodings
  • Save space using System.Zip
  • Decouple your code using a cross platform publish/subscribe mechanism


  • Giving a new appearance to the standard FireMonkey controls using styles
  • Creating a styled TListBox
  • Impressing your clients with animations
  • Using master/details with LiveBindings
  • Showing complex vector shapes using Paths
  • Using Firemonkey in a VCL application
  • Reinvent your GUI a.k.a Mastering Firemonkey controls, shapes and effects


  • Synchronizing shared resources with TMonitor
  • Talking with main thread using a thread safe queue
  • Synchronizing multiple threads using TEvent
  • Displaying a measure on 2D graph like an oscilloscope
  • Using the Parallel Programming Library in the real world: Tasks
  • Using the Parallel Programming Library in the real world: Futures
  • Using the Parallel Programming Library in the real world: Parallel For/Join


  • Developing web client JavaScript applications with WebBroker on the server
  • Converting a console service application to Windows service
  • Serializing a dataset to JSON and back
  • Serializing objects to JSON and back using RTTI
  • Sending a POST HTTP request encoding parameters
  • Implementing a RESTful interface using WebBroker
  • Controlling remote application using UDP
  • Using AppTethering to create companion app
  • Creating DataSnap Apache modules
  • Creating WebBroker Apache modules
  • Using native HTTP(S) client libraries


  • Taking a photo, applying effects, and sharing it
  • Using ListView to show and search local data
  • Using SQLite databases to handle a to-do list
  • Do not block the main thread!
  • Using a styled TListView to handle long list of data
  • Customizing the TListView
  • Taking a photo and location and sending it to a server continuously
  • Talking with the backend
  • Making a phone call from your app!
  • Tracking the application’s lifecycle


  • Using Android SDK Java classes
  • Using iOS SDK classes
  • Displaying PDF files in your app
  • Sending Android intents
  • Letting your phone talk: using the Android TextToSpeech engine
  • Using Java classes in Android apps with Java2OP
  • Do it in background, the right way: Android services

Some comments from the readers

Useful in every Delphi programmer’s library

“The book consists of well-contained individual chapters with clear, concise recipes for well-defined and useful tasks. The code is very easy to understand and follow, and the examples are chosen well. There is material here to make the book a worthwhile purchase for even the most experienced programmers. No source code examples have (yet?) been released, but the book remains useful still. I purchased this book directly from the publisher (I have been waiting for its release) and I am in no way affiliated with the author or the publisher. I have the first edition of the book too. I am also very happy with the first edition.”

— by _NM_ ( user)


“#Delphi Cookbook by @danieleteti. A must buy if you want to be a better Delphi developer.”

— @chillijay from twitter

“IMHO it’s by far the best Delphi book I’ve read. The clear and practical approach used by Daniele in describing ‘recipes’ applied to solve presented problems, makes this book an absolute must-have for every Delphi programmer; in the same way the Charles Petzold’s ‘Programming Windows’ was for the Win32 API C/C++ developer. Great job Daniele!”

— Daniel Merli (Linkedin user)

“This book is worth more than 5 stars. This is a very nicely prepared, well written and typeset, Delphi book, targeting Delphi programmers who wants to pick up nice gems about new generation of Delphi programming. As a “cookbook”, this is not a systematic book, but a book with valuable programming tips and such. The writer fulfills this objective very well. The format of the book is of a concise style, totaling a little around 300 pages. As a reader, you don’t feel over-dragging by verbose lines (as some other books do), while getting the points quickly. Undoubtedly, the author is a technical guru, he is also a great writer. My only quibble – it would be great if the sample code is better formatted. I am looking forward to more books of this author. Thumbs up.”

— Wuping Xin ( user)

“This is a beautifully written piece of work. The clarity and preciseness of the presentation, and the diversity of the topics (applicable to the last 2 Delphi releases) makes this book an invaluable reference source for a host of features.This book is pure gold (and dirt cheap).”

— An ADUG member

“I just got the eBook version and it is great! Thanks for putting it together – very useful recipes!”

— nmadani (blog user)

“Daniele, your contribution to the Delphi community is priceless! I’ve just ordered the book!”

— claudio.piffer (blog user)

“I read the index of your book and I decided to buy it. I like it and found it very useful!”

cniebla (blog user)

I hope you enjoy the reading!

–Daniele Teti