Fearless Cross-Platform Development with Delphi

Book description

Learn to rapidly build and deploy cross-platform applications from a single codebase with practical, real-world solutions using the mature Delphi 10.4 programming environment

Key Features

  • Implement Delphi's modern features to build professional-grade Windows, web, mobile, and IoT applications and powerful servers
  • Become a Delphi code and project guru by learning best practices and techniques for cross-platform development
  • Deploy your complete end-to-end application suite anywhere

Book Description

Delphi is a strongly typed, event-driven programming language with a rich ecosystem of frameworks and support tools. It comes with an extensive set of web and database libraries for rapid application development on desktop, mobile, and internet-enabled devices. This book will help you keep up with the latest IDE features and provide a sound foundation of project management and recent language enhancements to take your productivity to the next level.

You'll discover how simple it is to support popular mobile device features such as sensors, cameras, and GPS. The book will help you feel comfortable working with FireMonkey and styles and incorporating 3D user interfaces in new ways. As you advance, you'll be able to build cross-platform solutions that not only look native but also take advantage of a wide array of device capabilities. You'll also learn how to use embedded databases, such as SQLite and InterBase ToGo, synchronizing them with your own custom backend servers or modules using the powerful RAD Server engine. The book concludes by sharing tips for testing and deploying your end-to-end application suite for a smooth user experience.

By the end of this book, you'll be able to deliver modern enterprise applications using Delphi confidently.

What you will learn

  • Discover the latest enhancements in the Delphi IDE
  • Overcome the barriers that hold you back from embracing cross-platform development
  • Become fluent with FireMonkey controls, styles, LiveBindings, and 3D objects
  • Build Delphi packages to extend RAD Server or modularize your applications
  • Use FireDAC to get quick and direct access to any data
  • Leverage IoT technologies such as Bluetooth and Beacons and learn how to put your app on a Raspberry Pi
  • Enable remote apps with backend servers on Windows and Linux through REST APIs
  • Develop modules for IIS and Apache web servers

Who this book is for

This book is for Delphi developers interested in expanding their skillset beyond Windows programming by creating professional-grade applications on multiple platforms, including Windows, Mac, iOS, Android, and back-office servers. You'll also find this book useful if you're a developer looking to upgrade your knowledge of Delphi to keep up with the latest changes and enhancements in this powerful toolset. Some Delphi programming experience is necessary to make the most out of this book.

Table of contents

  1. Fearless Cross-Platform Development with Delphi
  2. Contributors
  3. About the author
  4. About the reviewer
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share Your Thoughts
  6. Section 1: Programming Power
  7. Chapter 1: Recent IDE Enhancements
    1. Understanding the Delphi IDE
    2. Delphi 10 Seattle
    3. Delphi 10.1 Berlin
    4. Delphi 10.2 Tokyo
    5. Delphi 10.3 Rio
    6. Delphi 10.4 Sydney
    7. Summary
    8. Questions
    9. Further reading
  8. Chapter 2: Delphi Project Management
    1. Technical requirements
      1. Creating a console application
      2. Building a Windows VCL application
      3. Starting a multi-device application
      4. Working with dynamic libraries
      5. Understanding packages
      6. Dealing with Android services
      7. Customizing your favorite project types
    2. Using build configurations effectively
      1. Build events
    3. Working with related projects
    4. Managing source modifications
      1. Looking through your code history
      2. Integrating source repositories
    5. Using the command-line tools for build automation
    6. Summary
    7. Questions
    8. Further reading
  9. Chapter 3: A Modern-Day Language
    1. Technical requirements
    2. Remembering Delphi's Pascal roots
      1. Reviewing the syntax
    3. Growing a language
      1. Adding objects to Pascal
      2. Promising functionality with interfaces
      3. Handling unknown data types
      4. Supporting nested types
      5. Migrating to Unicode
      6. Applying strong type checking generically
      7. Adding anonymous methods for cleaner code
      8. Adding metadata to your classes with attributes
    4. Learning about the latest enhancements
      1. Simplifying variable declaration
      2. Controlling initialization and the finalization of records
    5. Summary
    6. Questions
    7. Further reading
  10. Section 2: Cross-Platform Power
  11. Chapter 4: Multiple Platforms, One Code Base
    1. Technical requirements
    2. Moving to FireMonkey from the VCL
      1. Starting a new Windows FireMonkey project
      2. Migrating an existing Windows VCL application to use FireMonkey
    3. Preparing other platforms
      1. Preparing a Mac for cross-platform development
      2. Running your first cross-platform application
      3. Preparing for iOS development and deployment
      4. Preparing your PC to deploy to an Android device
    4. Working with various screen sizes
      1. Exploring target views
    5. Writing code to support multiple platforms
    6. Summary
    7. Questions
    8. Further reading
  12. Chapter 5: Libraries, Packages, and Components
    1. Technical requirements
    2. Sharing code in libraries
      1. Things to keep in mind for the Windows platform
      2. Loading libraries dynamically versus statically
      3. Things to keep in mind for non-Windows platforms
    3. Putting code into packages
      1. Working with package filenames
    4. Turning a package into a component
      1. Creating our first component
      2. Adding in the code to a component
      3. Adding design-time properties to a component
      4. Adding cross-platform support to components
    5. Summary
    6. Questions
    7. Further reading
  13. Chapter 6: All About LiveBindings
    1. Technical requirements
    2. Using the LiveBindings designer to get started quickly
      1. Using layers to group LiveBindings elements
      2. Revealing embedded component properties
    3. Creating magic with the LiveBindings Wizard
      1. Pulling in fields from a database
      2. Adding more controls through the wizard
      3. Prototyping custom objects at design time
      4. Swapping out prototype data for your own custom data
    4. Applying custom formatting and parsing to your bound data
      1. Getting to the BindingsList
      2. Customizing the display
      3. Parsing edited data
    5. Coding your own LiveBindings methods
    6. Summary
    7. Questions
    8. Further reading
  14. Chapter 7: FireMonkey Styles
    1. Technical requirements
    2. Understanding and using FireMonkey styles
      1. Loading style sets
      2. Selecting between multiple StyleBooks
      3. Accessing substyle definitions
    3. Customizing FireMonkey styles with the Style Designer
      1. Creating a default style for a control type
      2. Creating a custom style for a specific control
    4. Styling your applications with ease
      1. Quickly setting a single, application-wide style
      2. Customizing styles per form
      3. Managing style resources with code
    5. Summary
    6. Questions
    7. Further reading
  15. Chapter 8: Exploring the World of 3D
    1. Technical requirements
    2. Getting started with 3D in Delphi
      1. Adding 2D controls to a 3D form
    3. Adding basic and extruded shapes
      1. Showing lines for the axes
      2. Extruded shapes
      3. User-defined shapes
    4. Adding color, lighting, and movement
      1. Adding a light source to colors and textures
      2. Coloring extruded objects
      3. Adding animation
      4. Animating color
    5. Importing 3D models
    6. Changing the camera
      1. Multiple cameras
      2. Satellite camera
      3. Testing on phones
    7. Let's write a game!
      1. Implementing hidden clickable areas
      2. Activating and deactivating an object
      3. Mixing 2D and 3D controls for best use of each
      4. Working with layered objects at design time
      5. Deciding on the end game
    8. Summary
    9. Questions
    10. Further reading
  16. Section 3: Mobile Power
  17. Chapter 9: Mobile Data Storage
    1. Technical requirements
    2. Comparing different approaches
      1. Learning about InterBase's editions
      2. Introducing SQLite
    3. Managing databases
      1. Using the InterBase Server Manager and IBConsole
      2. Trying out SQLite Studio
    4. Setting up access to tables and queries
      1. Utilizing FireDAC, Delphi's cross-platform Data Access Component
      2. Getting table and query records from InterBase
      3. Getting table and query records from SQLite
    5. Deploying your database
      1. Deploying IBLite and IBToGo
    6. Updating data on a mobile device
      1. Understanding touch-oriented interfaces
    7. Summary
    8. Questions
    9. Further reading
  18. Chapter 10: Cameras, the GPS, and More
    1. Technical requirements
      1. Setting up
    2. Establishing a base
    3. Getting permission
      1. Setting up permissions for Android apps
      2. Using sensitive services on iOS
    4. Capturing your neighborhood
      1. Saving an image to the database
      2. Loading previously taken images
      3. Expanding your use of the camera
    5. Marking your spot
      1. Getting permission for location services
      2. Saving coordinates in the database
      3. Showing the location in the list view
    6. Mapping your way
      1. Setting up a Google Maps API key for Android
      2. Setting up your Delphi project to use Google Maps
      3. Plotting park points
      4. Changing the map style
    7. Sharing your pictures
    8. Summary
    9. Questions
    10. Further reading
  19. Chapter 11: Extending Delphi with Bluetooth, IoT, and Raspberry Pi
    1. Technical requirements
    2. Starting with Bluetooth Classic
      1. Configuring Classic Bluetooth
      2. Discovering and pairing devices
      3. Publishing Bluetooth services
      4. Connecting and communicating
    3. Learning about low-energy Bluetooth
    4. Utilizing beacons
      1. Setting up a beacon server app
      2. Finding and reacting to beacon messages
      3. Fencing your application
    5. Doing more with the Internet of Things
      1. Discovering and managing your device
      2. Getting data from IoT devices
    6. Using a Raspberry Pi
      1. Using Android to run your apps on a Raspberry Pi
    7. Summary
    8. Questions
    9. Further reading
  20. Section 4: Server Power
  21. Chapter 12: Console-Based Server Apps and Services
    1. Technical requirements
    2. Starting with console apps on Windows and Linux
      1. Installing the Windows subsystem for Linux
      2. Running our first Linux app
      3. Adding a simple database lookup module
      4. Testing the data module with a console app
    3. Providing remote server connectivity for clients
      1. Testing with a console client
    4. Logging activity
      1. Sending logs in two directions
      2. Adding a custom logging mechanism
    5. Creating a Windows service
      1. Logging to the Windows Event Log
    6. Adopting a Linux daemon
    7. Exposing your server to the world
      1. Modifying our client app to use the new server
    8. Summary
    9. Questions
    10. Further reading
  22. Chapter 13: Web Modules for IIS and Apache
    1. Technical requirements
    2. Surveying website-building options in Delphi
      1. Understanding the Web Server Application wizard
    3. Getting comfortable with the underlying framework
      1. Templating your HTML
    4. Building an ISAPI web module for IIS on Windows
      1. Logging from an ISAPI web module
    5. Getting started with the Apache HTTP server
      1. Installing and starting Apache on Windows
      2. Installing and starting Apache on Linux
    6. Writing cross-platform Apache web modules
      1. Deploying an Apache web module on Windows
      2. Deploying an Apache web module on Linux
    7. Summary
    8. Questions
    9. Further reading
  23. Chapter 14: Using the RAD Server
    1. Technical requirements
    2. Establishing a use case for RAD Server
      1. Considering an application's multi-user needs
      2. Enabling push notifications for registered devices
      3. Justifying the cost
    3. Getting familiar with what's included
      1. Running RAD Server on a development environment
      2. Using the RAD Server Management Console
    4. Writing modules to extend your server
      1. Using the wizard to create our first resource package
      2. Implementing MyParks for RAD Server
      3. Building a REST server without code
      4. Testing RAD Server with the REST Debugger
      5. Inserting, updating, and deleting data
    5. Modifying MyParks for use with RAD Server
      1. Setting up RAD Server connection components
      2. Sending updates back to RAD Server
    6. Summary
    7. Questions
    8. Further reading
  24. Chapter 15: Deploying an Application Suite
    1. Technical requirements
    2. Configuring for a wide audience
      1. Getting settings in desktop applications
      2. Updating a web module with dynamic settings
      3. Updating a RAD Server package with dynamic settings
      4. Reviewing mobile data storage locations
    3. Securing data
      1. Securing your server's data transmission
      2. Controlling access to resources
      3. Adding application security for RAD Server clients
      4. Protecting your hardware and operating system
    4. Adding a graphical touch
      1. Iconifying desktop apps
      2. Iconifying mobile apps
      3. Setting splash screen options on iOS
      4. Creating splash screens for Android
    5. Establishing product identity
      1. Including Windows version information
      2. Identifying your Apple product
      3. Identifying your Android product
    6. Testing for deployment
      1. Using virtual machines
      2. Testing the wide range of mobile devices
    7. Distributing the final product
      1. Installing RAD Server modules to production
      2. Selecting deployment configuration
      3. Deploying macOS and iOS applications
      4. Deploying an Android app
    8. Summary
    9. Questions
    10. Further reading
  25. Assessments
    1. Chapter 1 – Recent IDE Enhancements
    2. Chapter 2 – Delphi Project Management
    3. Chapter 3 – A Modern-Day Language
    4. Chapter 4 – Multiple Platforms, One Code Base
    5. Chapter 5 – Libraries, Packages, and Components
    6. Chapter 6 – All about LiveBindings
    7. Chapter 7 – FireMonkey Styles
    8. Chapter 8 – Exploring the World of 3D
    9. Chapter 9 – Mobile Data Storage
    10. Chapter 10 – Cameras, the GPS, and More
    11. Chapter 11 – Extending Delphi with Bluetooth, IoT, and Raspberry Pi
    12. Chapter 12 – Console-Based Server Apps and Services
    13. Chapter 13 – Web Modules for IIS and Apache
    14. Chapter 14 – Using RAD Server
    15. Chapter 15 – Deploying an Application Suite
    16. Why subscribe?
  26. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts

Product information

  • Title: Fearless Cross-Platform Development with Delphi
  • Author(s): David Cornelius
  • Release date: October 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781800203822