class as interface: Operator not applicable to this operand

Once in a while I run into this problem and every single time it takes me forever to remember the cause: Say, you have got an interface and a class implementing that interface: type IMyInterface = interface function asMyInterface: IMyInterface; end; type TMyClass = class(TInterfacedObject, IMyInterface) private function asMyInterface: IMyInterface; end; [...] function TMyClass.asMyInterface: IMyInterface; … Continue reading class as interface: Operator not applicable to this operand

Experimental GExperts Version 1.37-2014-09-04 released

The latest version is the first version that supports Delphi XE7. There is nothing really new about the formatter code. But the new release can be installed even if you don't have the official GExperts installer (yet). This is an extract from the readme file: ** Installing without an official installer ** With two Delphi … Continue reading Experimental GExperts Version 1.37-2014-09-04 released

Translating Windows messages to strings

I could not find anything like this so I wrote it myself: This class translates most Windows message ids into their symbolic name. type TWmMessageToString = class function MsgToString(const _WmMsg: Cardinal): string; overload; function MsgToString(const _Msg: TMessage): string; overload; end; The names are taken from Delphi 2010's messages.pas Delphi 2010's controls.pas Wine It seems pretty … Continue reading Translating Windows messages to strings

Preventing a dialog from closing while autocomplete is active

In an older blog post I wrote about AutoComplete for TEdits using SHAutoComplete. I just actually tried to use that function in one of my applications and found that there is a quite annoying problem with it: If you have set the OK button's Default property to true (so it gets "clicked" when you press … Continue reading Preventing a dialog from closing while autocomplete is active