Delphi Cookbook - Second Edition - Programmer Books

[Pages:100]1



Delphi Cookbook

Second Edition

Over 60 hands-on recipes to help you master the power of Delphi for cross-platform and mobile development on multiple platforms

Daniele Teti

BIRMINGHAM - MUMBAI



Delphi Cookbook

Second Edition

Copyright ? 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: September 2014 Second edition: June 2016

Production reference: 1280616

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78528-742-8



Credits

Author Daniele Teti

Reviewer Roman Yankovsky

Commissioning Editor Priya Singh

Acquisition Editor Rahul Nair

Content Development Editor Deepti Thore

Technical Editor Mohita Vyas

Copy Editor Merilyn Periera

Project Coordinator Shweta H. Birwatkar

Proofreader Safis Editing

Indexer Monica Ajmera Mehta

Graphics Disha Haria

Production Coordinator Arvindkumar Gupta

Cover Work Arvindkumar Gupta



About the Author

Daniele Teti is a software architect, trainer, and consultant with over 20 years of

professional experience. He writes code in a number of languages but his preferred language for compiled native software, is Object Pascal. Daniele is an Embarcadero MVP and is a well known Delphi and programming expert in the developers' community. He's the main developer and drives the development of some Delphi open source projects (DelphiMVCFramework, LoggerPro, DORM--"The Delphi ORM", Delphi Redis Client, Delphi STOMP Client, and so on). After writing some articles for the most important programming magazines in Italy and a number of on-line publications, Daniele started to write books. His Delphi Cookbook, published in late 2014, has been a bestseller. Daniele wrote his first program when he was 11 year old, and since then happily continues to write software almost every day. Apart from Delphi, he's a huge fan of design patterns, open source, distributed architectures, RESTful architectures, and Android OS. Daniele has been the project manager for a lot of big projects in Italy and in Europe, for private companies and public institutions. When is not busy writing software or writing about programming (for a job or for a hobby), he like to play guitar, write songs, and do voluntary activities. Currently he is CEO of BIT Time Professionals, an Italian company specializing in high level consultancy, training, and development. The company specializes in high performance software, web and mobile solutions, and distributed architecture. Bit Time Professionals is also an Italian leader about indoor proximity solutions using beacon technology, where it provides solutions for museums, supermarkets, art galleries, fairs, and events in general. Daniele acts as a consultant and teacher for many Italian and European companies, so he travels very often around the world. Daniele is the technical director for the ITDevCon conference, the biggest European Delphi conference (itdevcon.it). He's also an international speaker at technical conferences. Daniele lives in Rome, Italy, with his beloved wife Debora and their little boy Mattia.

Thank you to my wife Debora and my son Mattia.



About the Reviewer

Roman Yankovsky is a long time Delphi developer who has been working with Delphi

since Delphi 2. He has developed and maintained various applications in different industries. Currently he is working with ShareBike, developing a public bike sharing system. Roman is an Embarcadero MVP and a frequent speaker at developer conferences. Most recently, his focus is on the development of productivity tools for developers. He is the author of the FixInsight static analysis tool for Delphi.





eBooks, discount offers, and more

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@ for more details. At , you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

TM

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why Subscribe?

ff Fully searchable across every book published by Packt ff Copy and paste, print, and bookmark content ff On demand and accessible via a web browser



Table of Contents

Preface

v

Chapter 1: Delphi Basics

1

Introduction

1

Changing your application look and feel with VCL styles and no code

2

Changing the style of your VCL application at runtime

5

Customizing TDBGrid

9

Using owner draw combos and listboxes

16

Making an owner draw control aware of the VCL styles

19

Creating a stack of embedded forms

25

Manipulating JSON

28

Manipulating and transforming XML documents

34

I/O in the 21st century ? knowing the streams

44

Creating a Windows service

47

Associating a file extension with your application on Windows

52

Be coherent with the Windows look and feel using TTaskDialog

58

Chapter 2: Becoming a Delphi Language Ninja

71

Introduction

71

Fun with anonymous methods ? using higher-order functions

72

Writing enumerable types

76

RTTI to the rescue ? configuring your class at runtime

80

Duck typing using RTTI

84

Creating helpers for your classes

88

Chapter 3: Knowing Your Friends ? the Delphi RTL

99

Introduction

99

Check strings with regular expressions

100

Consuming RESTful services using native HTTP(S) client libraries

106

Cope with the encoded Internet world using Encodings

119

i



................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download