Additional
AnyDAC for Delphi and FireMonkey
Posted by Support [Jul 23, 2012]
AnyDAC for Delphi v 6.0.1 offers the FireMonkey support additionally to VCL and console based applications. The supports includes FireMonkey implementation for all AnyDAC dialog components on Windows, Mac OS X and iOS platforms. This is the breaking change, as it replaces pre 6.0 AnyDAC GUIx components.

Introduction

AnyDAC uses the set of IADGUIxXxx interfaces to obtain the UI integration services. In pre 6.0 versions these interfaces were implemented by TADGUIxFormsXxx and TADGUIxConsoleXxx components for VCL and console applications.

 

  With adding FireMonkey platform to the Delphi, we decided to have the single set of TADGUIxXxx components but with different implementations. And add FireMonkey implementation. The TADGUIxXxx.Provider property controls the implementation. Each implementation is located in the corresponding unit.
 

Setup

In 6.0 a component implementation may be controlled by:

 

  • At design-time by TADGUIxWaitCursor.Provider property. It controls default AnyDAC implementation and sets implementation for the wait cursor.
  • At design-time by TADGUIxXxx.Provider property. It sets implementation for the corresponding component. Depending on the value the corresponding unit will be linked into application.
  • At run-time you will need to set Provider property and add a required unit by the hands.

 

Note, to add corresponding unit to the "uses" clause at design time, after setting Provider property you will need to save the form. At moment the following Provider values and implementations are supported:

 

ValueDescription 
FormsVCL based implementation for Delphi / C++ Builder on Windows.
LCL based implementation for Lazarus / FPC on Windows, Linux.
FMXFireMonkey based implementation for Delphi / C++ Builder XE2 and higher on Windows, Linux, Mac OS X, iOS.
ConsoleConsole based implementation. 

 

So, for example, drop TADGUIxWaitCursor and set Provider to Forms at design time, and uADGUIxFormsWait unit will be added. Set Provider to FMX and uADGUIxFMXWait unit will be added. Also, the default Provider value will be FMX. Note, this works only for Delphi 6 and higher.

Upgrading

To upgrade from pre 6.0 version to 6.0 version you will need to take the steps:

 

  • Remove all uADGUIxXxx units from the uses clauses;
  • Replace TADGUIxFormsXxx components with TADGUIxXxx components. And set Provide property to Forms.
  • Replace TADGUIxConsoleXxx components with TADGUIxXxx components. And set Provide property to Console.
  • Force any modification on the form with TADGUIxXxx components, eg move a component. And save the form. So, the corresponding implementation unit will be added.

Switching

To switch between different implementations you will need to set components Provider property or just set TADGUIxWaitCursor.Provider to required default implementation.

 

It is not effective to link both VCL and FMX into application. We will suggest to have separated data modules for VCL and FMX. One with Provider=Forms setup. Another with Provider=FMX setup. Then use conditional compilation to include required data module. Note, that the TADGUIxXxx component properties are the same for all implementations. Also, no problems to have VLC / FMX and Console in the same application.

 

And the example. There is VCL (Forms) Login dialog on Windows XP for Firebird connection:

 

VCL Login

 

And the FireMonkey (FMX) Login dialog on Mac OS X for SQLite connection:

 

FMX Login

Starting

If you just want to develop a FireMonkey application, then just drop TADGUIxWaitCursor and set it Provider property to FMX. Check that uADGUIxFormsXxx units are not included into "uses" clauses.

Summary

The new GUIx architecture enables cross-platform support for GUIx AnyDAC layer. Now it is possible to use AnyDAC dialogs in cross-platform applications, additionally to invisible AnyDAC components.

 

Add Comments