A colleague of mine asked me today, how this could be: Given this exception handler: [delphi] try // some code that calls methods except on e: Exception do LogError(e.Message); end; [/delphi] How could e be nil? (and e.Message result in an Access Violation?) It turned out to be an error in one of the methods … Continue reading When an exception is nil in the exception handler
Category: Delphi
Fixing the Delphi 10.2.2 February 2018 Patch
UPDATE: The problem was that I was using Delphi 10.2.2 build 1978. Apparently I have missed an update in December 2017 to build 2004. I have downloaded and installed the new version, and now the patch worked fine. I hereby apologize for being stupid, because it clearly says in the description: This patch for RAD … Continue reading Fixing the Delphi 10.2.2 February 2018 Patch
My improved version of IMAPCopy
IMAPcopy is a tool written by Armin Diehl. Its purpose is to copy emails from one IMAP server to another (or from one IMAP account to another) including the folder hierarchy and even the read status. It's a command line program written in Delphi and fpc. Since I am currently migrating a mail server I … Continue reading My improved version of IMAPCopy
Extended = Double in Lazarus Win64
Note to self: In Lazarus Win64 there is no floating point type Extended, it's mapped to Double. So, overloading something like: [delphi] function TryStr2Float(const _s: string; out _flt: Extended; _DecSeparator: Char = '.'): Boolean; overload; function TryStr2Float(const _s: string; out _flt: Double; _DecSeparator: Char = '.'): Boolean; overload; function TryStr2Float(const _s: string; out _flt: Single; … Continue reading Extended = Double in Lazarus Win64
Warning: RAD Studio 10.2.2 Tokyo February 2018 Patch has issues
Embarcadero just released a patch for RAD Studio 10.2.2. I downloaded and installed it, and regretted doing that: It breaks linking projects with runtime packages, like GExperts, any other IDE expert and probably also most component packages. See here for a discussion. I submitted a bug report as RSP-19914.
Fake TSpeedButton based on a TBitBtn – updated
I have made a few changes to the code in Fake TSpeedButton based on a TBitBtn: I replaced all that line drawing with a call to the WinAPI function DrawEdge. I set both bitmaps to Transparent. I moved the bitmap generation to a sub procedure. Thus I got rid of about 20 LOC. That's negative … Continue reading Fake TSpeedButton based on a TBitBtn – updated
Fake TSpeedButton based on a TBitBtn
When you google for TSpeedButton and Focus a lot of hits are where people ask how to set the focus to a TSpeedButton and the answer of course is, that it isn't possible because TSpeedButton descends from TGraphicControl which does not have a window handle and therefore cannot receive the input focus. And that is … Continue reading Fake TSpeedButton based on a TBitBtn
Beware: IOTAComponent.GetPropValue needs 4 bytes for an enum
The ToolsAPI interface IOTAComponent declares two methods for getting property values: [delphi] IOTAComponent = interface(IUnknown) // [...] { Given the index or name, returns the property value. The untyped var must be large enough to hold the returned value. If the property is a descendant of TPersistent, the return value is a IOTAComponent. For properties … Continue reading Beware: IOTAComponent.GetPropValue needs 4 bytes for an enum
System wide mouse gestures with dzMouseGestures
When Mozilla released their last big update, they deprecated quite a few APIs for plugins. One of these plugins was FireGestures which I used to get some of the mouse gestures of Opera in Firefox. There are a few new plugins that try to replace FireGestures but none of them really seemed to work quite … Continue reading System wide mouse gestures with dzMouseGestures
Getting a good night’s sleep is important
Today, I finally found the time to read up on some rather ancient e-mails. One was from Paolo in the dxgettext mailing list about a bug in gnugettext.pas: With SVN revision 75 and the following, AddDomainForResourceString() has no effect, additional translations are not used. Suggested patch: original code from SVN revision 79: [delphi] function TGnuGettextInstance.LoadResString( … Continue reading Getting a good night’s sleep is important