specialising in clinical database solutions for Australian hospitals
Archive for June, 2014
Upgrade your project to Delphi XE6 and add VCL Styles to give a modern look – watch out for a few issues
Jun 27th
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
Upgrading from Delphi XE to Delphi XE 6 – relatively painfree but some issues
Jun 26th
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.
Is it time for Delphi XE VCL programmers to upgrade to Delphi XE 6 before the 30th June 2014 offer expires?
Jun 19th
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.
Recent Comments