Reader small image

You're reading from  Expert Delphi - Second Edition

Product typeBook
Published inFeb 2024
Reading LevelExpert
PublisherPackt
ISBN-139781805121107
Edition2nd Edition
Languages
Right arrow
Authors (2):
Marco Cantù
Marco Cantù
author image
Marco Cantù

Marco Cantù is an experienced Delphi expert, who started working with the product since its introduction in 1995. He is currently working as a Product Manager for RAD Studio at Embarcadero Technologies, an Idera company. Prior to that, Marco was a Delphi trainer and consultant for Wintech Italia. Over the years, Marco has written 20 books on Delphi, from the classic Mastering Delphi series to the recent Object Pascal Handbook. Marco has been a speaker at many Delphi and programming conferences worldwide, including over 10 Borland US Conferences, the Software Development Conference, Borland European conferences, EKON (Germany), DCon (UK), Conference to the Max (Holland), DelphiTage, the Italian Delphi Day, and a few editions of Delphi Developer Days. Marco is based in Italy.
Read more about Marco Cantù

Paweł Głowacki
Paweł Głowacki
author image
Paweł Głowacki

Paweł Głowacki was Embarcadero's European Technical Lead for Developer Tools. Previously, Paweł spent over 7 years working as a senior consultant and trainer for Delphi within Borland Education Services and CodeGear. Apart from working with Embarcadero customers across the region, he represented Embarcadero internationally as a conference and seminar speaker. Paweł passed away in mid-December 2017, but he is alive in the hearts of the Delphi developers community, worldwide.
Read more about Paweł Głowacki

View More author details
Right arrow

Fasten Your Seat Belts

The key benefit of Delphi in mobile development is that you can design your app once and you can natively compile it for both Android and iOS from the same source code. This chapter is exactly about this capability. We are going to install Delphi, create a simple one-button “Hello World” app, and then run the same app on an Android phone and an iOS device.

The integrated development environment (IDE) is where the programmer spends most of their time. Learning best practices of using the IDE will pay off in the future and will increase your developer productivity. Before building apps, you need to feel comfortable working in the Delphi IDE.

The objective of this chapter is to help you install the Delphi IDE, learn basic IDE functionality, and prepare it for mobile development.

In this chapter, we will cover the following topics:

  • Delphi installation
  • Riding the IDE
  • Deploying to mobile devices

Delphi installation

Delphi is a Windows program, so you need to have a computer with a proper version of Windows installed and enough free space on your hard drive. You may want to install Delphi on a physical computer or a Windows virtual machine image using one of the available virtualization solutions, such as VMWare. In this case, you can also use a Mac computer with a Windows virtual machine. Installing it on a virtual machine has some advantages in cross-platform development. To create iOS apps, you will need to have access to a Mac computer anyway. This could be another computer available on the local network or the same physical machine configured with a virtual machine to run the IDE. Whether you choose to install Delphi on a physical or virtual Windows machine, the installation process is the same.

Delphi is implemented as a native Windows 32-bit executable, but it is recommended to install it on 64-bit versions of Windows 11, or a recent 64-bit version of Windows 10.

...

Riding the IDE

In a nutshell, Delphi is a program for making other programs. The program responsible for generating executable files from the source code is a compiler. It is typically implemented as a command-line application, but it can also be invoked directly from the IDE. When executing the compiler as a command-line application, you can pass to it command-line parameters. As depicted in Figure 1.6, compilers take different command-line parameters, including the location of source code files necessary to generate the resulting binary file:

Figure 1.6: A simplified compiler architecture

Figure 1.6: A simplified compiler architecture

It is possible to write your programs using a text editor such as Notepad and then execute the compiler from the command line, but it is not the most efficient way of creating applications. Most programmers use IDEs to work on apps. The idea of an IDE originates from Delphi’s ancestor – Borland Turbo Pascal, in the 1980s – and it comes from the...

Deploying to mobile devices

Our DelphiHelloWorld project is now ready for deployment to mobile devices. We have already built and run it on Windows. Now, we are going to deploy it to an Android device, and then to iOS.

There is a one-time preparation phase for mobile development that you need to go through after Delphi is installed. We want to get to the point in which you can see your devices as targets inside the Project Manager area.

For Android, all the steps to configure your system to detect your device are described at https://docwiki.embarcadero.com/RADStudio/en/Configuring_Your_System_to_Detect_Your_Android_Device.

Deploying to Android

Deploying apps from Delphi to Android devices is simpler than deploying to iOS. You only need to have an Android device and a USB cable to connect your device to a Windows machine where you have Delphi installed.

The first step is to enable USB debugging on the device. This option can be set in Developer options on your device...

Summary

In this chapter, we installed Delphi and configured it for mobile development, configuring the SDKs for Android and iOS. We also learned about some of the basic functionalities of the IDE.

Now, we are going to change gears and focus on the Object Pascal programming language. This is the programming that’s used by Delphi – the language itself is also known as the Delphi programming language.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Expert Delphi - Second Edition
Published in: Feb 2024Publisher: PacktISBN-13: 9781805121107
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Marco Cantù

Marco Cantù is an experienced Delphi expert, who started working with the product since its introduction in 1995. He is currently working as a Product Manager for RAD Studio at Embarcadero Technologies, an Idera company. Prior to that, Marco was a Delphi trainer and consultant for Wintech Italia. Over the years, Marco has written 20 books on Delphi, from the classic Mastering Delphi series to the recent Object Pascal Handbook. Marco has been a speaker at many Delphi and programming conferences worldwide, including over 10 Borland US Conferences, the Software Development Conference, Borland European conferences, EKON (Germany), DCon (UK), Conference to the Max (Holland), DelphiTage, the Italian Delphi Day, and a few editions of Delphi Developer Days. Marco is based in Italy.
Read more about Marco Cantù

author image
Paweł Głowacki

Paweł Głowacki was Embarcadero's European Technical Lead for Developer Tools. Previously, Paweł spent over 7 years working as a senior consultant and trainer for Delphi within Borland Education Services and CodeGear. Apart from working with Embarcadero customers across the region, he represented Embarcadero internationally as a conference and seminar speaker. Paweł passed away in mid-December 2017, but he is alive in the hearts of the Delphi developers community, worldwide.
Read more about Paweł Głowacki