Delphi

How to implement Yield in Delphi

Delphi programming language has all the guts to compete with C# and Java. For example, you can quite easily implement C# yield return in Delphi:

How to use MSXML properly in Delphi

Using MSXML in Delphi is quite simple, except couple of caveats:

Consider the following sample code:

procedure Proc1(Node: IXMLDOMNode);
var
  i: Integer;
begin
  for i := 0 to Node.childNodes.length - 1 do
  begin
    if Node.childNodes.item[i].nodeName = 'test' then
    begin
      Proc2(Node.childNodes.item[i]);
    end; 
  end;
end;

it kinda does the job, but if you put the following assertion (check line #05):

How to Create Native Cocoa applications in Delphi XE2 (without FireMonkey)

While official Embarcadero materials emphasize only FireMonkey technology in light of creating MacOSX applications, it is yet very possible to create Cocoa applications w/ native MacOSX look and feel without using FireMonkey at all: Embarcadero have performed all the necessary job of translating Objective-C Cocoa headers to Delphi; compiler and debugger environment is working fine for non-FireMonkey applications.

So, in order to create 100% native Cocoa applications in Delphi XE2 you will have to master the following:

How to Fix Properly "Symbol Resume is deprecated" Warning in Delphi 2010

If you'll upgrade to Delphi 2010, you'll quickly notice that old code you were using to create threads, such as

How to Support "System Font" in InputQuery Delphi Function

If you have applied my techniques fixing Large Fonts and System Font to all forms in your Delphi application, most likely there will be two forms still untouched. These will be the forms hidden inside MessageDlg and InputQuery VCL functions.

In this post I will show how to modify InputQuery to support System Font.

How to Support "System Font" in Delphi Applications

Most Delphi applications are using MS Sans Serif 8 as their default font, meanwhile Windows XP system font is Tahoma 8.25 and Windows Vista system font is Segoe UI.

Below code makes Delphi applications support Windows system font:

How to Support "Large Fonts" / "Custom DPI" in Delphi Applications

99% of Delphi applications I have seen, do not support Large Fonts, or support it very badly. There is a Scaled property in TForm, people think it is about to scale the form in case of non-default DPI setting, but it is just not working properly.

Below code scales TForm the correct way:

Invoking WinAPI Functions in Delphi using Dot Notation

Windows API functions are declared in structured programming style.

For example consider classical example of using critical sections:

Syndicate content