The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘Delphi XE6’ Category

In `System.SysUtils`, `class function TCardinalHelper.Parse` throws errors for valid Cardinal values

Posted by jpluimers on 2016/10/05

Oh nice System.SysUtils.TCardinalHelper.Parse:

class function TCardinalHelper.Parse(const S: string): Cardinal;
begin
  Result := StrToInt(S);
end;

Which means you get this nice EConvertError with message ''4294967295' is not a valid integer value'. with this simple test (which doesn’t even reach the Assert):

uses
  System.SysUtils;

procedure Cardinal_Parse_High_Cardinal_Succeeds();
var
  Expected: Cardinal;
  Value: string;
  Actual: Cardinal;
begin
  Expected := High(Cardinal);
  Value := Expected.ToString();
  Actual := Cardinal.Parse(Value);
  Assert(Expected = Actual);
end;

So I write some unit tests (see below) of which helpers for these types fail in one way or the other:

  • Cardinal
  • NativeUInt
  • Single
  • Double
  • Extended

These work for the boundary cases:

  • SmallInt
  • ShortInt
  • Integer
  • Int64
  • NativeInt
  • Byte
  • Word
  • UInt64
  • Boolean
  • ByteBool
  • WordBool
  • LongBool

 

–jeroen

via: Oh nice, in System.SysUtils: “` class function TCardinalHelper.Parse(const…

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »

How to deploy a Delphi OSX project from the command line – kouraklis.com

Posted by jpluimers on 2016/09/28

This is so cool: How to deploy a Delphi OSX project from the command line – kouraklis.com [WayBack]

I always wanted to hack the communication path to PAServer [WayBack] – despite issues – but never had the time. Luckily others had…

See:

The reason I like this very much are many. Just a few:

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Delphi Code Monkey: Delphi Features I Avoid Using And Believe Need to be Gradually Eliminated from Codebases

Posted by jpluimers on 2016/09/21

Hear, hear! Delphi Code Monkey: Delphi Features I Avoid Using And Believe Need to be Gradually Eliminated from Codebases

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2007, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

New Book: MVVM in Delphi by John Kouraklis should be available at the beginning of november.

Posted by jpluimers on 2016/09/13

John Kouraklis last week announced a new book: MVVM in Delphi.

It will be available early november and is already listed at the APress site: MVVM in Delphi – Architecting and Building Model View ViewModel Applications [WayBack] where you can pre-order.

It’s good to see that the last years more Delphi books have been published and I hope this MVVM book falls in the more advanced category.

Since I’ve given a few Delphi MVVM talks (latest at https://github.com/jpluimers/Conferences/tree/master/2013/20131121-BE-Delphi) I’m genuinely interested. So I will get this book and – time permitting – write a review.

Nick Hodges did the technical review, and since Nick’s book are great I have high hopes (:

From the APress site:

Full Description

Dive into the world of MVVM, learn how to build modern Windows applications, and prepare for cross-platform development. This book introduces you to the right mindset and demonstrates suitable methodologies that allow for quick understanding of the MVVM paradigm. MVVM in Delphi shows you how to use a quick and efficient MVVM framework that allows for scalability, is of manageable complexity, and provides strong efficiency.

One of the biggest challenges developers face is how to convert legacy and monolithic Delphi applications to the MVVM architecture. This book takes you on a step-by-step journey and teaches you how to adapt an application to fit into the MVVM design.

What you’ll learn

  • Gain the fundamentals of MVVM
  • Visualize MVVM as a design philosophy
  • Create easy-to-use frameworks for building your own MVVM applications
  • Develop a methodology for converting legacy applications to the MVVM pattern
  • Architect cross-platform and multi-lingual applications using the MVVM pattern

Who this book is for

Delphi developers with a good knowledge of Delphi or programming experience in a different language. In addition, this book is attractive to Delphi developers who want to modernize existing applications based on the MVVM design.

and

Table of Contents

1. MVVM as Design Pattern
2. Setting Up the POSApp
3. MVVM as Design Philosophy
4. Two-way Communication
5. MVVM and Delphi
6. Planning the Application
7. Developing the Application
8. How to Convert your App to MVVM
A. Appendix: Other MVVM Delphi frameworks

–jeroen

via: New Book: MVVM in Delphi… [WayBack]

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Delphi version info table: C# Builder, Delphi 8 through 10.3 Rio and Appbuilder

Posted by jpluimers on 2016/09/06

I’ve published the Delphi version info table as a Gist: https://gist.github.com/jpluimers/b5891600b73642788b492393710c6070.

Note I need help with these:

The updated script that forms the base of this table is here: https://bitbucket.org/jeroenp/wiert.me/src/tip/Native/Delphi/Scripts/List-Delphi-Installed-Packages.ps1

You can pass any of these args to get information

  • Individual columns:
    • CompanyNames, Versions, ProductNames, ProductVersions, BetaNames. ReleaseDates, Architectures, CharacterSets, Defines, CompilerVersions, RTLVersions, DllSuffixes, ProjectVersions, Frameworks, ProductVersions, ProductFullNames, BaseKeyPaths, HKCU-BaseKeyPaths, HKLM-BaseKeyPaths
  • Base of the below table:
    • ProductSummaries
  • Installed info (installation status obtained through the registry):
    • InstalledProductVersions, InstalledProductFullNames, InstalledProductSummaries, InstalledPackages

An elaborate wrapper around the Define column is jedi.inc which is used in many projects (both open source and closed source) to distinguish between various Delphi versions, libraries and platforms at compile time (URL: github.com/project-jedi/jedi/blob/master/jedi.inc)

Read the rest of this entry »

Posted in .NET, C#, C# Builder, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »

Delphi: Alt+Down Arrow is the keyboard shortcut for ellipsis buttons

Posted by jpluimers on 2016/09/01

Thanks Primož Gabrijelčič for reminding me on Stack Overflow that Alt + Down opens the dialogs behind ellipsis buttons in the Delphi IDE.

It’s the CUA and Windows short-cut to open drop-down lists (comboboxes) and for opening drop-down list for a property in the object inspector, but I never realised also would work for these ellipsis buttons.

This was my original stack-overflow question: Is there a keyboard shortcut for the ellipsis buttons of the Project Options in the Delphi IDE?

The Project Options in the Delphi IDE has a few option (like the Search Path) each with an ellipsis button (the one on the right having only three dots ... in the image below) to pop-up a dialog.

What keyboard shortcut activates that button?

Project Options with ellipsis button

–jeroen

Via: Object Inspector Keyboard Shortcuts – RAD Studio

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Keyboards and Keyboard Shortcuts, Software Development | Leave a Comment »

Workaround for Printing from Delphi (or the Delphi IDE): three strikes and you get “Printer is not currently printing.” – yes I mentioned “Delphi 8!”

Posted by jpluimers on 2016/08/31

Recently when printing the 3rd time and up, you get this error in many Delphi programs and the Delphi IDE:

Printer is not currently printing.

Printer is not currently printing.

In the past this only occurred when you used a TPrinter and forgot to call BeginDoc.

But now it always occurs after reusing the same TPrinter instance for the 3rd time and up. Since the Delphi Galileo based IDEs (8 and higher; likely older ones as well: the source code printing hasn’t changed in a long time). The error actually occurs twice: after starting a source code print job, but also after cancelling the same failed source code print job.

The second error stroke me as odd, so I went searching for “printer is not currently printing” “IDE” leading to this stack overflow question: c++builder – Why is TPrinter (XE7) suddenly having problems today? – Stack Overflow [WayBack].

The pattern there is using the Printer() function which has been the way the (un)official code examples have shown for ages (Delphi 2007 Printers.Printer Function [WayBack]; earlier examples like Delphi 7 [WayBack] usually in PDF files).

Like in the Delphi 7 “5-32 Developer’s Guide” page example:

procedure TForm1.Button1Click(Sender: TObject); 
var
  r: TRect;
  i: Integer;
begin
  with Printer do
  begin
    r := Rect(200,200,(Pagewidth - 200),(PageHeight - 200)); 
    BeginDoc;
    Canvas.Brush.Style := bsClear;
    for i := 0 to Memo1.Lines.Count do
      Canvas.TextOut(200,200 + (i * Canvas.TextHeight(Memo1.Lines.Strings[i])),
    Memo1.Lines.Strings[i]); 
    Canvas.Brush.Color := clBlack;
    Canvas.FrameRect(r);
    EndDoc; 
  end;
end;

(Yes, that’s back in the D7 days when examples were still using with and not using try/finally statements for resource cleanup).

Actual cause and permanent fix

The printing problems are caused by various recent Windows updates part of MS16-098:

Though MS16-098: Security update for Windows kernel-mode drivers: August 9, 2016 mentions the issue without a fix, KB3177725 in MS16-098: Description of the security update for Windows kernel-mode drivers: August 9, 2016 mentions both the issue and a permanent fix:

After you apply this security update and you print multiple documents in succession, the first two documents may print successfully. However, the third and subsequent documents may not print.

To resolve this issue, install update 3187022. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

3187022 Print functionality is broken after any of the MS16-098 security updates are installed

This article describes printing issues that occur after any of the security updates that are described in Microsoft Security Bulletin MS16-098 are installed in Windows. You can fix these issues by installing the update that is described in this article. Before you install this update, check out the Prerequisites section.

This update applies to the following operating systems:

  • Windows Server 2012 R2
  • Windows 8.1
  • Windows RT 8.1
  • Windows Server 2012
  • Windows Server 2008 R2 Service Pack 1 (SP1)
  • Windows 7 SP1
  • Windows Server 2008 Service Pack 2 (SP2)
  • Windows Vista SP2

No solution for Windows 10 yet…

Until you install the fix: workarounds

For your own code (Thanks Remy Lebau for your answer), add this code for your BeginDoc call:

MyPrinter.Copies := MyPrinter.Copies;

You might want to keep including this in your code as you’re never sure when the end-users apply which Windows update.

For the Delphi IDE either:

  1. Press the “Setup…” button in the “Print Selection” dialog when printing source code, then “OK” in the “Print Setup” dialog:
    Print Selection dialog

    Print Selection dialog

    “Print Setup” dialog.

  2. Uninstall the security updated marked in blue (Security Update for Microsoft Windows (KB3177725):

    Security Update for Microsoft Windows (KB3177725)

    Security Update for Microsoft Windows (KB3177725)

–jeroen

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »

UCL as a Delphi package name suffix – remember before the KSDev days?

Posted by jpluimers on 2016/08/31

A while ago, I noticed the UCL as a suffix in a few 3rd party Delphi package names.

It was from a version close to the very first FireMonkey release. FireMonkey is based on the OpenGL based VGScene (and in part DirectX based [WayBack] DXScene) which was bought form KSDev in 2011.

Contrary to VGScene and DXScene, the early versions of FireMonkey were buggy and when updating to a new version you had to cope with a lot of breaking interface changes. In Delphi XE2 for instance, there were two totally different implementations (FMX for Windows and OS X; FMI for iOS) that merged after Delphi XE3.

Around Delphi XE6 it became more stable and now – apart from some design issues I wish they had done differently – it is coming along sort of OK for Windows and for cross-platform development.

Compared to the VCL you have a lot less HiDPI issues but the designer is much more layered (which gives you the same design-time pain as WPF) and the default “Live Binding” is still buggy as hell (though if you use something like MVVM or roll your own UI bindings it becomes bearable).

A long time ago – during the Kylix era – Borland developed the cross-platform CLX library which – for the UI part – was based on Qt and ran on both Windows and Linux.

It looks like before the KSDev take over there seemed to be a UCL (would that have been for Universal Component Library or Universal Control Library?) as the name pops up in quite a few package names.

Browsing through the source code I could not find any hints so I really wonder what UCL was about. Was it again based on Qt (which compared to the Kylix era has become much more mature and has widespread use) or a different technology like LCL (given that in Delphi XE2 they used FreePascal to compile for iOS)? I rule out OpenGL as otherwise the VGScene acquisition would have been done a lot earlier.

–jeroen

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 6, Delphi 7, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, FireMonkey, Kylix, OS X FMX, Software Development | Leave a Comment »

Why sometimes you *want* to to have your DFM files stored as binary

Posted by jpluimers on 2016/08/25

Delphi Component/Tool vendors have to support a truckload of Delphi and C++ Builder versions which can be a pain: they have to work around problems in Delphi and C++ Builder versions that have long been abandoned by Borland/CodeGear/Embarcadero/Idera/…

This means that sometimes the Delphi Component/Tool vendors have to work around stuff in a way normal applications vendors would never do.

Recently I learned that sometimes this can be a painful thing: keeping DFM files in binary state.

I’m not kidding about either the DFM file format nor about supporting old versions:

  • Delphi has supported text based DFM files since like Delphi 2 for most of the features (yes, ‘most’ is the crucial word here) and by default stored DFM files in text format since Delphi 5.
  • For the Component/Tool Vendors, even Delphi 7 makes money though usually less than Delphi 2007 or the C++ Builder side of things.

The ‘most’ applies to this nice ARM compiler bug in Delphi 19.0.13856.4978 (for mere mortals, that’s Update 1 for RAD Studio XE5, Delphi XE5 and C++Builder XE5; I wish vendors would list those numbers/products in a central place):

  • [Android] MsBuild (dccAarm) error when compile FireMonkeyMobile projects with fmx forms
  • Project:  Delphi
  • Build #:  19.0.13856.4978

Source: [WayBack] QualityCentral

That’s why TeeChart still has most DFM files stored as binary files (again the ‘most’ word).

For version control and searching this is a pain, so normal application developers (the ones not using Delphi XE5 Update 1 for Android work) should run convert.exe with the -t (target=text) switch on DFM binary files.

Oh: this is fixed in version 19.0.13856.4978 (yes, that’s XE5 Update 2).

–jeroen

Via:

 

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Kylix, QC, Software Development | Leave a Comment »

Is there any way to get the modal Search and IDE Insight back? – via G+

Posted by jpluimers on 2016/07/28

I’ve quotes two of the G+ comments as they perfectly reflect my point of view: the non-modal search and IDE Insight – introduced somewhere after XE3 – are a dork to use.

I’m doing more Delphi work lately and these being non-modal seriously hinder my work (and it gets progressively worse on a 3K or 4K monitor).

In my book: why implement a feature to emulate the competition when you do it so badly?

So: are there any experts around that bring back the old search and IDE Insight behaviour back?

Asbjørn Heid, Oct 5, 2015: 

+Marco Cantù I’m pretty sure I’ve mentioned it before, but hey:

  • The new edit field cannot be placed in a position which does not require significant eye-focus change to read. This means it is significantly more cumbersome to use, as focus must be transferred to some “out of sight” area. In addition one does not get the same instant feedback that the IDE did register your F6 keypress. The old one was “in your face” instantly when you pressed F6, so no need to take your eyes off the form you’re designing, and it left no doubt about F6 being registered or not.
  • The dropdown list with suggestions that pops up when you type is much more difficult to read than the list in the old one, both due to positioning (thanks to the above) and due to length until it’s heavily constrained by input.
  • From what I recall, the new edit field does not behave the same when invoked repeatedly, requiring more keystrokes to get the same effect compared to the old. I haven’t used XE3 in ages though so I don’t recall the specifics anymore, just that the new feels more clunky to use.

That’s just off the top of my head. Yes I still use it, but not nearly as much as I did, and when I do it’s one to two orders of magnitude slower to use compared to the old one. Not because it searches slower, but because of the issues described above.

David Heffernan, Oct 5, 2015: 

+Marco Cantù I second what +Asbjørn Heid  said. When I press F6 now, I never know where to put my eyes. In XE3 a dialog popped up which took my attention.

Similarly for the non-modal search, although somehow I’m more used to the modern version now.  When compared with VS though the Delphi search is very lacking. The great thing about the VS search is that it gives live feedback on which text in the edit window match the text in the search window. If Delphi would do that it would make an immense difference. It’s definitely worth spending some time in VS using their search facility. And indeed in other IDEs / editors.

There was a lot of negative feedback on both of these changes when they were released. Surely Embarcadero noticed that.

–jeroen

via: F6 or [Ctrl] + .  does not open IDE Insight on DX. What am I missing?…

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Power User, Software Development | 2 Comments »