Migrating a Delphi XE6 project to Delphi 11

I have successfully migrated my very complex Delphi XE6 database application to Delphi 11 after upgrading my 3rd party control sets such as Infopower, 1st Class, Devart’s UniDac, QuickReports and TMS Smooth controls.

Practically the only issue I had was having to change the location of VCL Styles

The files for the VCL Styles in Delphi XE6 are located at C:\Users\Public\Documents\Embarcadero\Studio\14.0\Styles, however, in Delphi 11 they are located in C:\Users\Public\Documents\Embarcadero\Studio\22.0\Styles.

The project would not compile until I changed this location – unfortunately I can’t remember where I had to change it!

Issues with the Delphi 11 IDE itself

A fantastic new feature is the ability to hide non-visual controls from your form which makes form design much easier if you have a lot of non-visual controls as I do. Just toggle the icon 4th from the left at top of the IDE under the Menu.

The main issue I have is when using a high resolution screen (mine is 3200×2000), the following are annoying:

  • the non-visual controls sometimes are pushed together in top left corner region of your form such as when you open up the string list editor or when you run a compile
  • the font in the Devart Unidac SQL string list editor is tiny – but this presumably is a Devart issue as the stringlist editor for BDE TQuery has more readable font size

Some of the enhancements in Delphi 11 made since Delphi XE6:

Delphi XE7 (2014):

  • compile FMX projects for both desktop and mobile devices.
  • IBLite embeddable database for Windows, Mac, Android, and iOS
  • Multi-display support
  • Multi-touch support and gesture changes
  • Full-screen immersive mode for Android
  • Pull-to-refresh feature for TListView on iOS and Android
  • FMX save state feature.

Delphi XE8 (2015):

  • GetIt Package Manager
  • Embarcadero Community toolbar
  • Native presentation of TListView, TSwitch, TMemo, TCalendar, TMultiView, and TEdit on iOS
  • Interactive maps
  • New options for Media Library
  • InputQuery support for masking input fields
  • FireDAC improvements

Delphi 10 Seattle and update (2015):

  • Android Background Services support
  • TBeaconDevice class for turning a supported platform device into a “beacon”
  • FireDAC support for NoSQL MongoDB database
  • FireMonkey controls zOrder support for Windows
  • Support for calling WinRT APIs
  • StyleViewer for Windows 10 Style in Bitmap Style Designer
  • High-DPI awareness and 4k monitor support
  • FMX Grid control for iOS
  • iOS native UI styling
  • New FMX feature demos
  • Platform support for iOS 10 and macOS Sierra

Delphi 10.1 Berlin and updates (2016):

  • Windows Desktop Bridge support
  • Android 6.0 support
  • EMS Apache Server support
  • Hint property changes
  • Address book for iOS and Android
  • CalendarView control
  • TGrid support for iOS
  • ControlType toggle for Platform or Render
  • FMX ListView Items Designer
  • FMX Search Filter
  • Deployment of iOS apps to macOS Sierra
  • 50+ Internet of Things packages
  • Windows 10 App Store deployment
  • Quick Edit feature for VCL Form Designer
  • VCL calendar controls that mimic Window RT and provide backwards compatibility
  • Windows 10 styles for VCL and FMX

Delphi 10.2 Tokyo and updates (2017-2018):

  • 64-bit Linux support, limited to console and non-visual applications.
  • FireDAC Linux support for Linux-capable DBMS
  • MariaDB, MySQL, and SQL Server support, InterBase 2017 included in main installation
  • Firebird support for Direct I/O
  • New VCL controls for Windows 10
  • Improved QPS (Quality, Performance, Stability)
  • Over 140 fixes to customer reported Quality Portal issues
  • BPL package loading for Windows Creators Update
  • Improved support for latest versions of iOS and XCode
  • TEdit improvements on latest Android, faster controls rendering
  • Parse API for other providers
  • FireDAC improvements for SQL Server, InterBase 2017, ODBC
  • New VCL Controls and Layouts (Panels)
  • Dataset to JSON
  • Mobile platforms QPS
  • RAD Server licensing
  • User Experience improvements (manage platforms, progress bar on loading etc.)
  • FMX QuickEdits
  • Dark IDE Theme
  • Expanded RAD Server/ExtJS support
  • InterBase 2017 included in main installation
  • Mobile Support included in basic package
  • FMX UI Templates

Delphi 10.3 Rio and updates (2018-2019):

  • New Delphi language features – inline block-local variable declarations and type inference
  • FireMonkey Android zOrder, native controls, and API Level 26
  • Windows 10 VCL and High DPI improvements
  • RAD Server architecture extension and Docker support
  • Android push notification
  • Expanded support for iOS 12 and iPhone X series devices
  • RAD Server Console UI redesign and migration to the Ext JS framework
  • Improved FireDAC support for Firebird 3.0.4 and Firebird embedded
  • New VCL and FMX Multi-Device Styles
  • IDE Productivity Components
  • Quality improvements to over 150 customer reported issues
  • Delphi macOS 64-bit
  • RAD Server Wizards and Deployment Improvements
  • Android Push Notification Support with Firebase
  • Delphi Linux FireMonkey GUI Application Support
  • Delphi Android 64-bit support
  • macOS Catalina (Delphi) and iOS 13 support
  • RAD Server Docker support
  • Delphi Android 64-bit support
  • Delphi iOS 13 and macOS Catalina support
  • RAD Server Docker deployment
  • Improved App Tethering stability
  • Improved iOS push notification support
  • Debugger improvements

Delphi 10.4 Sydney and updates (2020):

  • Major Delphi Code Insight improvements
  • Unified Memory Management across all supported platforms
  • Enhanced Delphi multi-device platform support
  • Unified installer for online and offline installations
  • Windows Server 2019 support
  • Parallel programming component updates
  • Metal API support on OS X and IOS
  • 850+ enhancements and fixes
  • Multi-monitor and 4k scaling improvements
  • Parallel programming component updates
  • New VCL controls: TControlList and TNumberBox
  • MSIX app packaging format support
  • Installer supports silent, automated installations
  • Enhanced Migration Tool
  • Major compiler/IDE speed increases (over 30 IDE fix pack integrations)
  • Android 11, macOS11, iOS 14 support

Delphi 11 Alexandria and updates (2021-23):

  • High-DPI enabled IDE
  • VCL styles in the form designer
  • FireMonkey design guidelines
  • macOS ARM 64-bit target platform
  • Android API 30 support
  • Many IDE Improvements
  • Extensive High DPI IDE quality, plus improved use of the IDE with Remote Desktop
  • Improvements with High DPI designers for VCL and FireMonkey and the styled VCL form designer
  • GetIt Library Manager enhancements
  • Code Insight Across Delphi and C++Builder
  • The Delphi LSP engine saw big performance improvements
  • The Delphi and C++ compilers for the various platforms were improved in terms of stability and performance
  • Improved RTL, UI, and Database Libraries
  • Quality-focused release in update 2 and removal of Internet Explorer
  • iOS Simulator for Delphi
  • IDE enhancements, notably around ToolsAPI and Delphi LSP
  • Quality improvements in all areas of the application
  • Ubuntu 22 and Windows Server 2022 support

Posted in Delphi | Tagged , | Leave a comment

Upgrade your project to Delphi XE6 and add VCL Styles to give a modern look – watch out for a few issues

I have successfully migrated my very complex Delphi XE database application to Delphi XE6 after upgrading my 3rd party control sets such as Infopower, 1st Class, Devart’s UniDac, QuickReports and TMS Smooth controls.

Adding a VCL style to your application:

So I decided I would add in some VCL Styling which is extremely easy to add in – just go to Project Options, Application, Appearance, then tick the VCL styles you would like available to your application (these will be stored within the EXE), and select your Default style via the drop down box at the bottom.

The Delphi IDE writes to your project source file (the DPR file) the following: adds vcl.Themes and vcl.Styles to the Uses clause, and adds the default style to your application run code such as: TStyleManager.TrySetStyle(‘Aqua Light Slate’);

The files for the VCL Styles are located at C:\Users\Public\Documents\Embarcadero\Studio\14.0\Styles.

Don’t forget, you may be able to download Embarcadero’s “Premium Styles Pack” as part of your purchase of Delphi or RAD Studio – if so you will need to copy these to the above folder. This pack includes “Diamond”, “Jet” and “Sterling”

 

Let your user change style at runtime:

If you wish to allow your end users to change styles at runtime, then you can create a dialog form, place a combobox on it and add code:

Uses vcl.Themes, vcl.Styles;

procedure TdlgStyling.ComboBox1Change(Sender: TObject);
begin
TStyleManager.TrySetStyle(ComboBox1.text);
end;

procedure TdlgStyling.FormCreate(Sender: TObject);
var i:Integer;
begin
for i := 0 to High(TStyleManager.StyleNames) do
begin
ComboBox1.items.Add(TStyleManager.StyleNames[i]);
if (TStyleManager.StyleNames[i] = TStyleManager.ActiveStyle.Name) then
ComboBox1.itemIndex := i;
end;
end;

A few gotchas to take care of:

Not all controls display well with every style, so either avoid the style or turn off styling for the controls.

Things to watch out for include:

  • readability of hints – especially on the 1st Class OutlookBar
  • readability of coloured grid cells, especially if you set an Infopower wwDBGrid cell to pink or green and the style converts your black font to a light font.
  • readability of Infopower wwDBGrid title buttons – you can set DisableThemes or DisableThemesInTitles to True.
  • control brush colour will get over-ridden by styles – if you want toi ensure a particular colour is used, you will need to turn off style elements of seFont and seClient for that control, but you could probably leave seBorder active.
  • you may need to make some controls larger such as radiogroups as the checkboxes may become larger with certain styles.
  • some controls do not display or function correctly with styles active such as:
    • TwwDBRichEditMSWord on a dialog form displays some of the background form until the scrollbar is moved by the user – thus turn OFF style elements seClient and seBorder
    • TDateTimePicker – becomes a unusable mess with corruption of the form display if user tries to change date – thus turn OFF style elements seClient and seBorder
  • some colour schemes will just not suit your app!
  • allowing 28 of the provided styles available in your application will increase your exe size by about 1.3Mb in reality you would probably only use 1 orgive a few options at most.

Menus will get deranged if any menu items have visible = false and a VCL style is active

This is a Delphi vcl bug and applies to both TMainMenu and TPopup – items get changed in position and become associated with incorrect OnClick events!

There are a few reports posted on Quality Central indicating there are issues with DXE6 Update 1 – see http://qc.embarcadero.com/wc/qcmain.aspx?d=124944 and similar.

Menu issue workaround: The issue appears to resolve if you ensure there are no menu items with visible := false.

Access violations may occur which need sorting out:

Code which previously appeared to work flawlessly, may throw access violations as soon as you have a VCL style running

This may be happen due to some unorthodox ways forms are used – I managed to fix one of these by removing a call to a password dialog from the mainform’s OnCreate (I had it there as I used the type of log on to customise how the main form displays.

 

Making your own styles:

Delphi IDE includes are tool to let you do this – see Tools > Bitmap Style Designer

 More information on VCL Styles:

http://docwiki.embarcadero.com/RADStudio/XE6/en/Working_with_VCL_Styles

https://code.google.com/p/vcl-styles-utils/source/browse/#svn%2Fwiki

 

Posted in Delphi | Tagged , | Leave a comment

Upgrading from Delphi XE to Delphi XE 6 – relatively painfree but some issues

Issues for those upgrading from Delphi XE to XE6:

Variants.EmptyParam issue:

If you use COM, in addition to this not being cross-platform technology, if your code passes Variant.EmptyParam (as an OLEVariant) in code XE or earlier, you will need to modify your code as EmptyParam as of XE2 is a function not a OLEVariant variable you can pass as a Var in a procedure or function.

Solution:

To solve, this, for each var parameter, you must explicitly declare a variable as an OLEVariant, then use that variable in the procedure or function after you have set it’s value to Variants.EmptyParam.

for example:

procedure doSomeCOM;

var docfilename, docpassword:Olevariant; docs: Documents; doc:Document;

begin

docfilename := ‘mydoc.doc’;

docpassword := Variants.EmptyParam;

Docs := WordApp.Documents;
Doc := Docs.Item(Index);

Doc.someCOMFunctionTakingOLEVariants(docfilename, docpassword);

end;

NativeInt instead of Integer in some procedures and functions;

This will require changing variables for some functions such as Application.OnHel from LongInt to NativeInt;

Deprecated and removed Delphi language:

sysutils.shortdateformat no longer compiles, you need to create a variable of TFormatSettings, then you can access the global shortdateformat

More upgrade issues:

You will need at least 30GB free hard drive space on your C: drive to actually do the install!

BDE on 64 bit Windows:

See my earlier blogs on running this but assuming you have it running successfully, if you had BDE ticked in the Delphi XE6 install wizard then you may find you need to go into regedit and manually ensure that the path to the BDE library is correct. under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Borland\BLW32\

You will need to download and install the latest versions of other code sets such as:

Jedi JCL – 17th April 2014 version installed without issue

Jedi JVCL – I couldn’t get this one to load the jvclstdcontrols due to an error in the entry point – keep an eye out for latest version

IDE Fix pack – you need v5.6 for XE6 but seems there is no update of the MIDAS speed fix – so I disabled the older version I had as it caused syntax error.

Quickreports – at least their XE to XE6 upgrade is free BUT seems now you must explicitly set the default printer by adding qrepname.PrinterSettings.PrinterIndex := -1;

Infopower Studio – but now there is also a  Firemonkey component set – but not for the 1st Class VCL components at this stage at least.

Unidac database components from Devart – if you don’t want to try the task of migrating your code to Firedac components

TeeChart Pro – Delphi XE 6 does come with standard and “Lite” TeeChart components sets but if you need pro then you need to upgrade.

 

Posted in Delphi | Tagged , , | Leave a comment

Is it time for Delphi XE VCL programmers to upgrade to Delphi XE 6 before the 30th June 2014 offer expires?

Delphi programmers who have not upgraded since Delphi XE and thus have been very happy just sticking to their VCL programming have until 30th June 2014 to upgrade to Delphi XE 6. After this date, they will not be able to upgrade but will have to pay the full NEW price of the latest Delphi or RAD Studio version.

Should one upgrade now from a purely financial view point?

Short answer … probably yes especially if you really want to start using the many new features of XE 6 now rather than wait for XE 7 which will presumably be even better and will presumably have additional features such as support for iOS 8 development, Bluetooth tethered apps, etc.

Let’s do a little math using the Australian retail prices:

If we assume Delphi XE 7 prices will be similarly priced, then later this year or early next year, one could “upgrade” to Delphi XE 7 Enterprise via 3 mechanisms:

Buy Delphi XE 6 Enterprise now then upgrade again:

  • Delphi XE6 Enterprise upgrade from XE Enterprise = $AU2027 + 10% GST = $AU2290
  • Upgrade 3rd party tools from XE versions: QuickReport = $0 as same major version; Infopower Studio = $AU450; TMS packs eg. $AU 300; TeeChart Pro.  ~$250 = $AU1000
  • Delphi XE 7 Enterprise upgrade (“recharge”) from XE 6 Enterprise = $AU963 + 10% GST = $AU1059 (NB. RRP is actually $AU1624!)
  • Upgrade 3rd party tools from XE6 versions – may be minimal if the subscription license is for 12-24 months
  • Total cost = $AU2290 + $AU1000 + $AU1059 = $AU4349

Purchase Delphi XE  6 Enterprise upgrade and maintenance:

Cost for the upgrade to XE 6 will be ~$AU1000 more but then you get the next new version(s) released in the following 12 months for free – presumably that will give you XE 7 and XE 8, so it could be more cost effective than going for just a re-charge to XE 7, particularly, as I understand you also get access to every prior version as well which can be handy.

Ignore Delphi XE 6 and await Delphi XE 7 Enterprise:

  • Delphi XE7 Enterprise new price = $AU3379 + 10% GST = $AU3717
  • Upgrade 3rd party tools from XE versions: QuickReport = $0 as same major version; Infopower Studio = $AU450; TMS packs eg. $AU 300; misc.  $250 = $AU1000
  • Total cost = $AU3717 + $AU1000 = $4717

Conclusion – buying XE 6 now will get you started on the new features, and may just save a few hundred dollars (even more if you decide you don’t really need the XE 7 upgrade).

What do Delphi XE VCL programmers gain by upgrading to Delphi XE 6?

FireDAC database components and technology

  • very easy to migrate legacy BDE apps to FireDAC which is a far better solution than the now deprecated BDE
  • easily support different data types when programming for different databases such as Oracle vs MS SQL Server

Compile for 64-bit Windows applications

VCL styling – but XE6 Update 1 has bug issues with menus if any menu item has menuitem.visible = false

Live bindings to allow making almost any control data aware with a much improved binding interface

Easy REST client programming

Support for Windows 8 and “metro” style windows apps optimised for touch

Support for portable device sensor technologies such as location, gyroscope, etc.

Taskbar manager to allow nice taskbar icons showing app screen shots or button controls

Improved Datasnap

Zip file support

Easier remote debugging

Improved IDE Insight to help you find things while you program

App tethering

  • this allows your apps to easily discover and talk to each other across a network – this could be Win-Win or Win-iOS or Win-Android, etc
  • NB. Bluetooth tethering will probably come in XE 7

Improved IDE stability and quality control

Access cloud based BaaS – although these services are quite expensive

Wait, and there is more – the now maturing FireMonkey cross-platform technology

Much of the initial issues and bugs in FireMonkey and the process of developing for other platforms such as MacOS, iOS 7, and Android has been improved and simplified.

XE6 now also allows Google Glass development.

In app monetization via advertising banners and in-app purchase functionality – BUT only for Android and iOS apps

If developing native apps for these platforms is important then one should at least consider what FireMonkey can offer.

Others may prefer to just create web apps based upon HTML5 technology, but this may miss out on providing the same user experiences.

And as and added bonus, before 30th June – you get one free Embarcadero tool and some free goodies :

The price of the Embarcadero tool cannot exceed the price of your upgrade, and you must have installed and registered your upgrade, then accessed the bonus tool before 15th July.

The other free goodies include TMS VCL components including Smooth Controls Pack, Metro Pack and Windows 7 pack, total value of which would be worth around $AU300.

More information:

The ADUG president, Lachlan Gemmell, has created an excellent webinar describing these benefits for VCL programmers and this can be downloaded from Steve Arena’s online store for free.

 

What can we expect in Delphi XE 7 later this year?

  • Multi-Device Designer and Smart Layout Components.
  • iOS Native Controls.
  • DataSnap (EMS) device tracking/reporting mgmt. console, etc.
  • Bluetooth component with App Tethering Support.
  • More device support (Pebble Watch, Google Wearables SDK).
  • iOS8 and Android version upgrade.
  • more bug fixes – especially the VCLStyles menu bug – although hopefully this will be addressed in XE6 via a hotfix

 

Happy upgrading.

Posted in Delphi | Tagged , | Leave a comment

Migrating to DevArt’s UniDAC database connection components

I have a complex Delphi 2007 multi-user 24×7 MS SQL Server and Sybase ASE database application which uses dozens of TClientDatasets connected to TDatasetProviders which then connect to separate datamodules containing TDatasets (eg. TQuery or TSQLQuery) which link to a connection component (eg. TDatabase or TSQLConnection).

I have 3 almost identical versions with different datamodules:

  • a BDE version using TQuery components and this gives good performance and can do nested SQL statements but the BDE is problematic to install in a network environment, particularly with 64bit windows becoming more common, but more importantly, the BDE truncates varchar fields to 255 characters which is very limiting unless in SQL you convert them to text in which case they become memo fields, but then you need to inform user their input will be truncated to maximum of varchar setting.
  • a DBExpress version using TSQLDatasets which gives good performance but tends to have a few issues and cannot do nested SQL statements for complex reports.
  • an ADO version using TADOQuery components which gives poor performance, presumably as the ADO components also cache the data as do the TClientDatasets. I no longer use this version.

The word from Embarcadero now that they have purchased the excellent 3rd party database components – AnyDAC, is that AnyDAC will be included in Delphi XE4 – presumably late 2013 – but is no longer available for purchase separately, and that the DBExpress technology is likely to be deprecated given they had troubles addressing a few of its issues.

Given this news and not wanting to wait until Delphi XE4, I decided to jump in and buy DevArt’s UniDAC components for Delphi which come highly recommended.

The process of migration and the issues it raises.

After installing the Unidac components – very painless process indeed, you will discover a new item on the Delphi IDE menu bar – UniDAC under which you will find a Migration Wizard tool.

The good news is that the Migration Wizard is very easy to use and seems to work well by converting the BDE components to UniDAC components – just tell it which folder to convert and away it goes (best to back everything up first of course, although the wizard does have an optional backup functionality).

The bad news is that although the wizard will migrate from BDE, ADO and other DevArt components such as SDAC,  there is no option to migrate from DBExpress – this seems like it would require a significant amount of search and replace work in the pas and dfm files.

Obviously some BDE features will not be supported such as aliases and if your database connection or your code relies on this then these aspects will need addressing.

You will have to set the properties on the TUniConnection component (UniDAC database driver, server, database, username, password, then look in SpecificOptions to enter ApplicationName, WorkstationID, etc), plus you will need to reconnect all your dataset.connection properties to the TUniConnection component, plus if you are like me and using TClientDatasets, then you should set all the TUniQuery.UniDirectional = true.

If any of your SQL has double quotes, these will need to be changed to single quotes – easiest way to do this is by opening the datamodule as text file (right click then select “View as text”), then do a search and replace, replacing all ” with two single quotes.

Finally, you will need to drop the UniDAC provider components onto your datamodule – eg. TSQLServerUniProvider, TASEUniProvider.

Issues thus far:

  • certain TClientDatasets with Sybase “text datatype” fields crash the system when active set to true in either IDE or runtime if using the Sybase ASE connection – I am yet to work out what specifically is causing this when other similar datasets function well, and the TUniQuery opens rapidly without issue and the supplied DevArt dbMonitor suggests all is well. This is presumably an issue with the Sybase ODBC driver rather than UniDAC, and I would try changing to the DBExpress Sybase driver via UniDAC if I didn’t have to change all my datetime fields to SQLTimestamp fields.
  • UniDAC TUNiQuery does not allow nested SQL statements even if these are returning a single dataset.
  • Sybase ASE, Access, DB2, DBF databases are accessed via ODBC driver instead of a Direct UniDAC driver as is the case with Oracle, MS SQL Server, PostgreSQL, SQLite, and NexusDB
  • I am getting key violation errors which I didn’t get with record inserts with the BDE version – this may be related to the Sybase ODBC component – will investigate

Benefits of UniDAC:

  • no dll’s or BDE to install on end-user system which allows for a self-installing, self-configuring application to be easily made
  • performance seems good
  • ability to use multiple database engines and even write database-specific SQL with macros allowing clauses such as if Oracle then … etc. “server-independent SQL”
  • built-in debug option – set debug property to true and when dataset is opened, a dialog will display the SQL statement being sent
  • supplied with a dbMonitor which will show each SQL command sent, including parameters and time taken – just drop a TUniDBMonitor component on your datamodule and set it to active to allow this functionality (dbMonitor must be running prior to running your application).
  • it has far more versatility than DBExpress including:
    • ability to do SQL batch scripting to create and delete tables.
    • map data types – this can be particularly useful when using persistent fields and different database drivers
    • encryption functionality
    • assign table update SQL statements – although not needed if using TClientDatasets
    • stored procedure call generator
    • improved transaction control
    • ability to set a server table lock mode for each TUniQuery
    • each UniDAC driver has server specific options which can be set and these as well as the UniDAC driver are compiled within your application
    • ability to use other DevArt drivers such as SDAC if you need even more control over SQL Server or you wish to access SQL Server Compact Edition.
  • Disconnected Model with automatic connection control for working with data offline
  • Connection timeout management
  • Ability to search for installed servers in a local network
  • Local Failover for detecting connection loss and implicitly reexecuting certain operations
  • it seems fairly simple yet versatile

 

 

Posted in Delphi | Tagged , , , | Leave a comment

Delphi XE3 announced

Embarcadero’s Delphi RAD Studio programming IDE has a new version coming Sept 2012 – Delphi XE3.

I attended their World Tour presentation in Melbourne today and this post is to briefly inform of the new features it brings.

Windows 8 support:

  • easy VCL or FireMonkey form conversion to Windows 8 “Metro” style
  • ability to compile Windows 8 Desktop applications (32bit or 64bit) in either Delphi Object Pascal or with C++ (although 64bit C++ compiler will be in Q4)
  • new Windows 8 GUI “Metropolis” components such as MetropolisUIListBox
  • Office 2013 styling
  • Live Tiles WinRT support (but no WinRT application Delphi compiler as yet – this is coming, although you can compile WinRT apps using Delphi Prism and .NET via Visual Studio 2013)
  • video playback utilises DirectShow
  • support for gyrosensors, location services, etc
  • support for Surface Pro and Slate tablets
  • “Fat Finger” touch ready
  • the “Metropolis” Win8 Metro GUI-style Desktop apps can be used on Win XP, Vista, Win 7 or Win 8 and work as touch-enabled apps thanks to Delphi gesture control functionality

Mac OS X Mountain Lion support:

  • FireMonkey components automatically can detect and be optimised for pixel-perfect display on either Retina or non-Retina displays in the same binary executable
  • video playback utilises Quicktime
  • non-client area FireMonkey styling
  • Mac Apple store compatible

Revamped Firemonkey framework:

  • vector based, cross platform FireMOnkey framework was introduced in Delphi XE2
  • the framework has been revamped in XE3 and is now called FireMonkey2
  • it has been simplified via adding Visual Live Bindings, wizards, and support for anchors, layouts, non-client area styling, audio/video controls, actions and action lists
  • Mac OS Retina display optimised
  • a new component TPrototypeBindSource allows one to automatically generate a virtual dataset complete with data to link to to assist with mock up application development without need to create an actual database, and this component can also be used to create Live Bindings to custom classes.
  • TDatasource is no longer needed, just link a BindSource to a dataset such as TClientDataset

New Visual Live Bindings:

  • makes creation of Live Bindings far easier – just drag and drop
  • ability to group various Live Bindings together into a “layer” which allows simplification of the visual appearance of these by optionally “disabling” other layers to make the layer you are working with easier to see.
  • layer data is stored in files with extension .vlb
  • seems the Visual Live Bindings functionality can only represent one form at a time?
  • improved dataset lookup support
  • can be used in VCL or Firemonkey

New HTML5 Builder:

  • a totally revamped IDE of what was formerly RadPHP
  • visual design of HTML5, CSS, javascript for client side, while using PHP scripting for server side web apps
  • utilises jQuery technology
  • deployment to mobile devices via PhoneGap services
  • “Phonegap takes your generated html, javascript and css files and injects it into a real .exe file for both Android and iOS. This real .exe file creates it’s own browser instance, puts the browser in full-screen – and disables the security restrictions that public browsers impose on you. Once wrapped, you can create persistent (non cached) databases beyond the usual 5 to 10 megabyte limitation.”
  • extensive code completion and help
  • embedded multimedia playback in web browsers
  • as I understand, this module does not allow one to program in Object Pascal while the compiler generates javascript so it will be interesting to see how this compares with IDE’s which generate HTML5, javascript from Object Pascal code such as Smart Mobile Studio (costs ~$450)

“Mobile”:

  • there will be a new, separate software package for compiling native mobile apps for iOS, android, Blackberry, and Windows Phone 7 called “Mobile”
  • this can be purchased and used separate to Delphi, or it can be added into the Delphi IDE as an optional add-on
  • it is NOT included in RAD Studio XE3 pricing!
  • it REPLACES the Delphi XE2 mechanism for compiling mobile apps which relied upon FreePascal and compiling in XCode
  • the new mechanism is MUCH easier to use and does not require external management
  • allows same Object Pascal code to generate native iOS, Android apps
  • new Interbase ToGo database can be deployed to mobile devices as an alternative to SQLite
  • Datasnap compatible
  • SQLite driver for DBX
  • supports device hardware such as gyro, GPS, camera and accelerometer
  • mobile device form designers

Delphi XE3 is a very timely product launch which will leverage the new requirements of Windows 8, and Mac OS Retina displays whilst significantly extending and simplifying cross-platform and mobile application development with tools such as FireMonkey and HTML5/CSS/javascript apps.

This will be a must buy version for those interested in such application development.

Posted in Delphi | Tagged | Leave a comment

Connecting to a password-protected Microsoft Excel spreadsheet using Delphi TADOConnection

There is a little trick to connecting to a password protected .xls Excel spreadsheet using the Jet 4.0 OLEDB driver.

 

If one uses the obvious Password=xxx;User Id=Admin you will get an error “Workgroup Information file missing or file is in use by another user”.

 

The ADOConnection will return an active connection is using the following connection string but in Delphi 2007 I am still getting an error on trying to read the file “Could not decrypt file”.

 

So here is the Connection String which will open the connection successfully in Read Only mode:

 

Provider:=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\MyExcel.xls;Mode=Read;Extended Properties=Excel 8.0;Jet OLEDB:Database Password="xxx";

 

It appears that “Could not decrypt file” error is due to a well known limitation of the Jet OLEDB 4.0 engine in that it always returns this error on trying to read a password protected Excel file even if passwords are known.

The hack around this is to open the file in Excel first in full read/write mode BEFORE opening the TADOConnection – just opening it in READ ONLY mode in Excel WILL NOT work!

This is not only an issue in Delphi but in any application that uses Jet 4.0 OLEDB engine.

Of course, another solution is to use COM OLE automation such as:

  • CreateOLEObject method – see here

Excel 2007 and higher files (.xlsx):

If you are dealing with .xlsx Excel 2007 or later files, you cannot use the Jet engine, but you can use the ACE OLEDB driver:

  • ACE 32bit OLEDB driver if 32bit Office is installed:
    • Provider := Microsoft.ACE.OLEDB.12.0;Data Source="C:\temp\MyExcel.xlsx";Extended Properties="Excel 12.0 Xml;HDR=YES;“;Jet OLEDB:Database Password=””;
  •  ACE 64bit OLEDB driver if 64bit Office installed and 64bit ACE installed:
    • Provider := Microsoft.ACE.OLEDB.14.0;Data Source="C:\temp\MyExcel.xlsx";Extended Properties="Excel 12.0 Xml;HDR=YES;“;Jet OLEDB:Database Password=””;
  • NB. YES you read correctly, that is Jet OLEDB:Database Password=””; and NOT ACE OLEDB:Database Password=””; !!! AND strangely enough, you can connect to a password protected file without supplying a password at all BUT, whether or not you supply a password, the password protected Excel file MUST be already open in full edit mode within Excel first!
  • NB. to install ACE 64bit on a machine which already has ACE 32bit installed, use command line: AccessDatabaseEngine_X64.exe /passive
  • to connect to Excel 97-2003 .xls via ACE use Extended Properties=”Excel 8.0;HDR=YES;”
  • to connect to Excel 2007-2010 .xlsx via ACE use Extended Properties=”Excel 12.0 Xml;HDR=YES;”
  • to connect to Excel 2007-2010 .xlsm via ACE use Extended Properties=”Excel 12.0 Macro;HDR=YES;”
  • to connect to Excel 2007-2010 .xlsb via ACE use Extended Properties=”Excel 12.0;HDR=YES;”
  • if you get the error “could not find installable ISAM”, you have probably made an error with the connection string.
  • unfortunately, if the Excel file is password protected to read, you will get an error “External table is not in the expected format” unless it is already opened in Excel and user has edit rights to the spreadsheet! So we have the same old situation as with the Jet OLEDB provider!
  • and don’t bother trying Password=”xxx”;User ID=Admin; as additional parameters, because as soon as you add a value for password, you get the same old Jet issue of “The workgroup information file is missing or opened exclusively by another user”.
Posted in Delphi | Tagged , , | Leave a comment

Database application development pathways with RAD Studio XE2

Embarcadero’s RAD Studio XE2 allows the following database development pathways:

 

Delphi Object Pascal or C++ generated DataSnap middle tier data servers which run on a Windows server and allows the following thin clients to connect to it:

  • Delphi Object Pascal or C++ VCL WinForms clients compiled for either Win32 or Win64
  • Delphi Object Pascal FireMonkey compiled for native client application for any of the following platforms:
    • Win64
    • Win32
    • Mac OS X
    • iOS
    • and in 2012, Linux and Java for Android
  • via Mobile Connectors:
    • Eclipse compiled java client for Android
    • XCode compiled iOS client for iPad, iPhone
    • Blackberry client
    • Windows Phone 7 client
  • isapi.dll web client hosted on a Windows web server
  • RADPhP web application hosted on a web server (requires the DataSnap server to be a REST application)
  • RADPhP mobile application packaged for mobile devices via PhoneCap
  • .NET client created using Delphi Prism (REMObject’s Oxygene) Object Pascal for .NET running in MS Visual Studio
  • ASP.NET web database application created using Delphi Prism (REMObject’s Oxygene) Object Pascal for .NET running in MS Visual Studio.
  • Java client created using REMObject’s Cooper project – Object Pascal for java running in MS Visual Studio (in development)

Third party REMObjects is extending its Hydra technology to allow FireMonkey plugins to work on VCL Winforms, and vice versa, as well as WPF plugins to work in FireMonkey apps and vice versa – see here.

RADPhP web database application using MySQL database.


 

Posted in Delphi | Tagged , , | Leave a comment

FireMonkey for cross-platform stunning visual business database applications – details

I had the honor yesterday of attending Embarcadero’s most exciting pre-release RAD Studio event yet – a summary of the new features are in the previous post.

This post I will explore the FireMonkey aspect of Delphi XE2 a bit more deeply.

Vector-based architecture features and implications:

  • Firemonkey architecture is presumably a significantly enhanced non-VCL successor to Kryukov’s KSDev vector-based VCL components including VGScene, DXScene, ImageFX and his iOS compiler, for which Embarcadero acquired the IP (apparently in Jan 2011 when further development of his VCL components was ceased, and would explain why the Delphi community was taken by surprise with the recent announcement of FireMonkey).
  • allows 3D modeling with all computing work performed by the device’s GPU (thus 3D features currently will not display if remote desktop or Citrix environment)
  • allows assigning data points on a 3D model which can then linked via the new LiveBindings functionality to a source data, thereby enabling live 3D charting, etc
  • can import various 3D models such as 3ds or Collada, with potential to add more support later.
  • full zoom in and out capability without image degradation which means controls look good even on small devices when zooming is applied
  • ability to apply 3D effects and filter effects to forms or components, thus one could create a page turning effect potentially.
  • a critical difference to other vector based frameworks such as Abobe Flash and Microsoft’s WPF (an XAML DirectX .NET based technology with data bindings, upon which Silverlight is built), is that Apple allows FireMonkey applications to be added to their iTunes app store and thus made available for use on iPhones and iPads (ie. it is FPC-compatible).
  • when compiled to a Windows platform, it utilises Direct2D and Direct3D, when compiled to Mac OS X or iOS, it utilises OpenGL.
  • it is currently designed for native applications (ie. running independently of any web browser) and not for Rich Internet Applications (RIA) within web browsers (as does Silverlight or Air), and is not specifically targetting gaming development.

FireMonkey components:

  • does not use Windows messaging and thus does not play well with visual VCL components in the same application, thus avoid them, BUT one still uses TDatasource, TClientDataset, etc.
  • source code included – 99% is Object Pascal code with only a small section of non-pascal GPU code
  • components designed to make migration from VCL as simple as possible by keeping similar naming and properties where possible but obviously events that take Windows messaging parameters had to be changed.
  • new LiveBindings functionality (which also is now on VCL) means almost any property of a control can be unidireectionally or bidirectionally linked to a source – be it a form variable or TDatasource.dataset field, or other control parameter, this also means, some properties such as position x are no longer integer but Double.
  • TFmxObject = class(TComponent);
  • any object can contain other components to make it versatile and very easy to create customised objects
  • just drop a component onto another component and it will become a child of that component – need to take care in the IDE when dropping components onto a form!
  • heavily dependent upon interfaces
  • IControl handles focus, mouse and keyboard events, implemented by TControl and TControl3D
  • IRoot is interface to top-level containers and is implemented by TCustomForm
  • IScene is the container for 2D objects and is implemented by TForm and TCustomLayer3D
  • IViewPort is the container for 3D objects (and requires a GPU), and is implemented by TForm3D and TViewPort3D
  • GPU-based shading filters which can be applied to bitmaps, forms and controls to give Photoshop-like effects
  • new Animation functionality which allows one to modify a property value over time and thereby create changing colors, changing position, etc.
  • new Styles is a CSS-like functionality which allows dynamic skinning with ability to save, load and modify at run time to dramatically alter the appearance of the application.
  • new StyleBook is a container for styles and provided styles include Win7, MacOSX, etc, but of course one can create their own styles.

Live Bindings:

  • available in VCL as well as FireMonkey and in effect makes ALL components and their properties data aware if you wish – very versatile and quite different to VCL’s data-aware approach which is not available in FireMonkey.
  • can specifiy unidirectional or bi-directional links which have read/write capability via use of expressions
  • a binding consists of 4 aspects:
    • source object – this may be a TDatasource.dataset.field or a form variable or component
    • source expression – a string which can be edited at runtime. For example, the name of the source property value you wish to bind to such as DisplayName if source is a TField
    • control object – this is the destination object that you are binding to.
    • control expression – a string which allows one to format the bound data for display, etc. and to specify the control property value which will be linked eg. label.text
  • bindings are stored in TBindingsList, and also allow you to register methods available to be called from the expression strings. The expression evaluation engine also accesses the RTTI.
  • one also needs to set a scope for the binding and this may be done automatically and uses TBindScope and TBindScopeDB (if linking to a TDatasource)
  • instead of TDBNavigator, there is a TBindNavigator which links to a TBindScopeDB or a TBindScope.
  • LiveBindings introduces wonderful new versatile opportunities (eg. you can bind to any component property and even to points on a 3D model) but does introduce a significant potential for runtime errors as the expression strings are no longer part of the compiler syntax mechanism, and particularly, if you change the name of a control or variable during refactoring and forget to change it within the expression, or just do a typing error, you will not get a compiler error but a potentially difficult to detect runtime error which may or may not create an exception.
  • to create a LiveBinding on a form control, just click on the LiveBindings property of the control and you will have the option of creating one manually or choosing “Link to DB Field” which will automatically place the LiveBinding comonents on the form, and will display all TDatasources and their fields for you to select a field to bind to.

Cross-platform RTL support:

  • TFormatSettings in SysUtils
  • TOSVersion
  • TZipFile in System.zip for crossplatform zip/unzip of files – now this will make life much easier!
  • TLoginCredentials
  • TPointF

Cross-platform debugging:

  • this has been simplified – one copies the Embarcadero Platform Assistant to the target machine or virtual machine, specify port and optionally password then just run it.
  • within Delphi IDE, define a remote profile specifying IP address, port and optionally password and remote paths.
  • Run with Debug

Cross-platform development limitations:

  • platform specific functionality obviously is not available for cross-platform compilation eg. Windows messaging (and thus the VCL), COM, menus (not available on iOS), OS API’s, MS XML transforms, etc
  • whilst many GUI applications MAY be applicable for use as is across multiple platforms, the reality is that you would probably wish to have a GUI that is optimised for each platform, and this too is obviously not only possible with FireMonkey, but the best approach for many applications.
  • presumably one could use compiler directives to access different API’s or to use COM for Windows compiles, or access iOS camera for iOS compiles.
  • issues with Free Pascal for developing iOS apps – see here.

Current limitation issues which will almost certainly be addressed by XE3 release in late 2012:

  • cannot compile to Linux, Android or Blackberry (but there are java based Datasnap client solutions for these platforms in the interim)
  • no Windows 8 specific support as this has not yet been released by Microsoft.
  • no customisable gesture support as is currently in the VCL, but usual gestures such as those on an iPad will work as they do normally without programming.
  • compilation to iOS is only Object Pascal (not C++ yet) as it relies upon compilation using FreePascal (and thus certain features such as Generics, Anonymous methods are not supported), and then requires one to use Apple’s xCode IDE to do the final compile – but at least one can debug and edit the Object Pascal code within xCode and changes made within Delphi are automatically visible in xCode without having to go through the FreePascal again.
  • iOS compile requirements:
    • Mac Snow Leopard on an Intel Mac
    • iOS SDK with developer subscription (4.2, 4.3)
    • xCode 3.25 or 3.26 to do the final compile
    • installed official FreePascal 2.4.4 binary required to build FPC 2.5.1
    • if using virtual machine on the Mac such as VMWare Fusion, ensure you save your project to a shared folder that can be accessed by xCode
    • once project saved in Delphi, use a command line utility to export to xCode files (in a subdrectory)
    • then run xCode in OS X and open that project in the xCode subdirectory and compile, debug or run on a connected physical device or an emulation of the device
    • your original object pascal code will be accessible, debuggable and editable within xCode!

Development machine:

  • It would seem for cross-platform development, the preferred environment may be Mac OS X running Delphi within a 64bit Windows VMWare Fusion virtual machine.
  • This would then allow running Apple’s xCode on the same machine and allow all debugging to be performed with the one computer.

 

Posted in Delphi | Tagged , , | Leave a comment

Embarcadero’s RAD Studio XE2 Delphi upgrade brings new exciting technology opportunities – native Win32, Win64, OSX, iOS, and Android apps and a new development platform – FireMonkey!

Delphi developers are in for a big surprise as the World Tour of RAD Studio XE2 brings them some very unexpected opportunities as well as the expected Win64 compiler.

Here are a few of the new features in XE2:

64 bit Windows compiler:

  • for most Win32 projects, just select compile to Win64 and you have native 64bit Windows executable or DLLs!
  • if your project uses 32-bit assumptions, then these will need to be addressed, but otherwise it should just work.
  • NB. NativeInt, NativeUInt, pointers, indexes to dynamic arrays, tag properties (now nativeInt) are 64bit
  • Use your same source code and project files – just select an additional platform to build for in the project window
  • Use the same Windows API calls in your code, although Microsoft have renamed some (eg. SetWindowsLong is now SetWindowsLongPTR)
  • Use the same Runtime Library classes and functions
  • Use the same VCL components and non-visual components
  • new compiler directives include Win64, CPUX64
  • can only access 64bit versions of dlls, ActiveX controls, bitmaps and COM objects (eg. 64bit MS Office will only work with 64 bit exe’s and vice versa)
  • Win64 now ignores register, pascal, cdecl, and stdcall, so these are ignored in 64bit compilations.
  • No Extended type
  • issues with assembly code, SHL and SHR

New FireMonkey GPU framework for NATIVE deployment to Win32, Win64, OSX, iOS and Android:

  • 1st the bad news – to convert your existing projects, you will have to migrate all your VCL-based code and components to FireMonkey components as the two are not compatible in the same project (because it does not directly use Windows messaging like the VCL does), and instead of data-aware components as in VCL, we now have Live data bindings for all components (these are also now available in VCL)
  • Now, the fantastic news:
  • awesome 2D and 3D rotatable, visual forms and components with enormous potential for native GUI apps
  • you can apply the Gaussian Blur filter on your form at a strength you deem appropriate when a modal form is activated in front of it
  • improved animations of visual controls
  • compatible with TClientDataset and DBExpress components
  • NATIVE deployment as Object Pascal code to target platforms including iOS and thus satisfies Apple’s iTune apps requirements
  • Create a single application and target both Windows and OS X
  • the framework makes extensive use of interfaces to establish contracts, not inheritance
  • it is not managed code like .NET nor does it use AIR, Silverlight, HTML5 or CSS for its functionality but native code

Enhanced DataSnap DBExpress functionality:

  • DBExpress ODBC driver
  • new mobile and cloud connectivity in RAD Cloud – Microsoft Azure and Amazon support
  • supports https
  • new Datasnap server functionality includes client connection information and management of the connection from the server with ability to limit number of requests per connection, and ability to detect connects, disconnects, and to forecfully disconnect clients.
  • DataSnap clients can be created for nearly every common device natively via FireMonkey although Linux, Android and Blackberry devices currently are limited to using java Datasnap mobile connectors, while Windows Phone 7 devices are limited to using C#/Delphi Prism Datasnap mobile connectors.
  • one creates an Android Datasnap client in Delphi XE2 by creating a REST application and ticking the mobile connectors option which adds a DSProxyDispatcher component which will generate project java files such as DSProxy.java which can then be imported into Eclipse IDE for packaging as an Android app.

Enhanced VCL functionality:

  • the VCL is NOT being made redundant as it is needed for Windows specific applications (eg. using COM, etc) and backward compatibility
  • new functionality includes option of using the incredibly versatile LiveBindings functionality (see next post on FireMonkey) and new VCLStyles which allows a different mechanism of skinning to FireMonkey as it allows the use of a vsf file to be loaded at runtime, or added to the executable in Project options application appearance section, and then allows use of TStyleEngine and TStyleManager to set styles or load from file, but these styles are not applicable to menus, popupmenus or ribbons.

New RadPHP functionality:

  • rich jQuery mobile components
  • Create mobile-optimized web applications and standalone apps for iOS and Android devices using RadPHP – PhoneGap wizard allows packaging your application by creating java files for import into Eclipse java IDE, selecting a target platform (eg. Android v2.2) and running in the emulator before uploading to the Android store.
  • Create mobile optimized web applications that work on all types of mobile devices with elements that behave similar to native mobile apps.
  • Take advantage of touch optimized layouts, user interface elements, and professional looking theming using HTML5, CSS3, and JavaScript on the client and PHP on the server in an easy-to-use and visual way that only RadPHP can offer.
  • Using jQuery in RADPHP and a technology called PhoneGap, you can now package up a PHP application and deploy it as a native Android application

Very exciting times indeed!!

You can register for the Australian part of the World Tour demonstrations here – the Melbourne event is next Thursday, the 11th August 2011.

 

Posted in Delphi | Tagged , , , , , , | Leave a comment