|Delphi Clinic||C++Builder Gate||Training & Consultancy||Delphi Notes Weblog||Dr.Bob's Webshop|
Cross-platform Application Development with Embarcadero C++Builder XE2 and FireMonkey
Embarcadero C++Builder XE2 is an integrated development environment (IDE) for writing applications that can run on Windows as well as Mac OS X. The C++Builder XE2 IDE itself is a Win32 application, but using the Platform Assistant Server, it can also debug applications that run on a Mac OS X machine.
Embarcadero FireMonkey is a business application platform that can be used with Delphi or C++Builder to produce native applications for Windows, Mac OS X and iOS (FireMonkey iOS applications are currently only available for Delphi XE2 and FireMonkey, but not yet for C++Builder XE2).
C++Builder XE2 can produce FireMonkey HD (High Definition) or FireMonkey 3D applications.
FireMonkey HD applications can generally be compared to VCL applications (tied to Windows), they open up target and deployment possibilities for Windows and Mac OS X now, and other platforms in the future. FireMonkey HD is similar to VCL, but not based on the Windows API. FireMonkey offers a broad set of visual and non-visual components to build cross-platform native applications that use themes and skinning to ensure a native look-and-feel.
FireMonkey 3D applications make extensive use of the Graphical Processor Unit (GPU) to take over the GUI presentation from the CPU, allowing the CPU to do more processing work, while the GPU is used for the presentation; a logical and very efficient model.
FireMonkey applications do not require a runtime like the .NET Framework, Mono or Java, but run natively on Windows or Mac OS X. FireMonkey 3D applications require a powerful GPU, using Direct3D on Windows and OpenGL on Mac OS X. In contrast, FireMonkey HD applications with 2D only require Direct2D or GDI+ on Windows, and Quartz on Mac OS X. FireMonkey HD applications will run fine on just about any machine, while FireMonkey 3D applications require more recent hardware.
The GPU is used for the 2D and 3D drawing, as well as all filters and effects on the drawings. For 2D drawings, FireMonkey can make use of GDI+ on older machines (but not for 3D drawings).
FireMonkey HD applications are typical business applications. C++Builder XE2 offers 29 Standard, 15 Additional, 1 System, 4 Dialogs, 3 Data Access, 8 dbExpress, 7 dbGo, 16 InterBase, 8 InterBase Admin, 2 Cloud, one DataSnap Client, 7 DataSnap Server, 8 Web Services, and 4 LiveBindings components; 113 in total, offering platform agnostic controls to build business and data driven applications.
Compared to the Visual Component Library (VCL), which is tied to the Windows API, there are no data-aware controls in FireMonkey. However, this concept has been replaced by a much more powerful LiveBindings architecture, allowing all controls to bind their contents or related properties to data sources or other properties from other components. While also available for VCL, LiveBindings allow FireMonkey applications to bridge the data layer with the GUI layer.
FireMonkey 3D applications are more powerful and GPU intense applications. This includes business applications with 3D and graphics effects. However, keep in mind that FireMonkey 3D applications use the GPU and require a more powerful machine than FireMonkey HD applications.
Apart from the 103 FireMonkey components available for the FireMonkey business applications, there are 11 new categories in the Tool Palette for FireMonkey HD or 3D applications that involve GPU effects in one way or another. These new categories are Grids (3), Common Controls (1), Animations (9), Colors (12), Effects (64), Viewports (1), Shapes (14), 3D Scene (4), 3D Shapes (15), 3D Layers (5) and Layouts (7) Ė a total of 135 additional components for HD and especially 3D effects to turn business applications into stunning and great looking applications, with the ability to compile and run them on both Windows and Mac OS X.
FireMonkey 3D applications use the IViewpoer3D to show a 3D representation on a 2D form. Unlike 2D controls and objects which use a Position property with X and Y values, a 3D object has X, Y and also Z coordinates in a TPosition3D type property. And apart from a Height and Width, the 3D objects also have a Depth property, so you can easily create simple 3D shapes with the TCube, TSphere and TCone classes.
While not commonly found in business applications, the FireMonkey 3D capabilities will be able to turn business applications into great looking modern applications, that will distinguish themselves from the competition.
Embarcadero C++Builder XE can produce Win32 as well as Mac OS X applications. For Win32 we can use VCL (Visual Component Library) for Windows-only applications, or FireMonkey for cross-platform applications. FireMonkey supports Win32, Win64 as well as Mac OS X at this time, and a subset of FireMonkey is also available for iOS. The Win64 and iOS targets are currently not available for C++Builder, but will be in future editions.
C++Builder FireMonkey projects will start with the Win32 target added as the default target. Since the IDE itself is also a 32-bit application, this makes initial development, testing and debugging very easy. When you want to test, deploy and/or debug the application on Mac OS X, you simply add a new target platform.
Prepare: Platform Assistant Server
A Target Platform also requires a Remote Profile, and for Mac OS X this means a Mac running OS X 10.5 or higher with the Platform Assistant Server installed on it. The latter can be installed using setup_pasver.zip on Mac OS X.
The Platform Assistant Server is only needed for deployment or debugging on a Mac OS X machine. Paserver is a terminal application, and you can specify the password here that development machines need to connect to the Mac.
With the Platform Assistant Server running on the Mac OS X target machine, a Remote Profile can be added to the OSX32 Target Platform. A Remote Profile consists of the name (or IP) of the remote Mac, the port number (64211 by default, see screenshot), the password, and for C++Builder developers a special page where we can define the place and files to cache. The default settings are typically OK and as follows:
Once the Target Platform and Remote Profile have been defined on the development machine, and the Platform Assistant Server is running on the Mac OS X machine, you can actually deploy and/or debug FireMonkey applications on the Mac.
This screenshot shows the Biolife data shown in a FireMonkey HD application running on Mac OS X.
FireMonkey applications for Windows can be debugged natively in the C++Builder IDE, but for a Mac OS X application the aforementioned Platform Assistant Server must be installed on the Mac OS X target machine, and a Remote Profile must be setup. Then, itís a matter of setting breakpoints and running the FireMonkey application from the IDE to launch it on the Mac OS X machine, and still show the source code with breakpoints in the development machine.
The C++Builder XE2 IDE includes a Deployment dialog can be used to deploy a complete FireMonkey application to Mac OS X as an application bundle. Note that the symbolic information must be cached first (when thatís not already the case), which typically happens once for every project deployment.
We can also add special feature files, like the MIDAS Library or specific dbExpress drivers.
C++Builder Enterprise includes DataSnap to build multi-tier applications. For the server side, this has no consequence (the server still needs to be a VCL application), but the DataSnap Client applications can be VCL (for Windows) or FireMonkey (for Windows as well as Mac OS X).
The following screenshot shows the FireMonkey DataSnap Client at design-time, using the DataSnap client components to connect to a DataSnap Server, as well as LiveBinding to display the data in a TStringGrid.
Embarcadero FireMonkey is a business application platform that can be used with Delphi or C++Builder to produce native applications for Windows and OS X. C++Builder XE2 can produce FireMonkey HD (High Definition) or FireMonkey 3D applications, to produce stunning business applications for Windows as well as Mac OS X.