picture

Open Folder Dialog in Delphi

November 1st, 2011

The function below uses ShellAPI and implements Open Folder Dialog. This function works fine on Windows XP and Windows7 as well.
Read the rest of this entry »

How to Copy Data from Grid and paste it into Excel

July 22nd, 2011

If you want to copy some lines of data from a Grid (Ctrl+C) and paste (Ctrl+V) it into an Excel document, just use following code:


procedure MyForm.Button1Click(Sender: TObject);
var
  i, j: integer;
  lString: string;
begin
  lString := '';
  for i := 0 to Grid.RowCount - 1 do begin
    for j := 0 to Grid.ColCount - 1 do begin
      lString := lString + Grid.Cells[j, i];
      if j < Grid.ColCount - 1 then
        lString := lString + #9;
    end;
    if i < Grid.RowCount - 1 then
      lString := lString + #13;
  end;
  Clipboard.AsText := lString;
end;

With few modifications this code can be also applied to TDrawGridEx.

Xml Alternative for Delphi’s INI Files.

March 31st, 2011

I found on the net the way how to use XML files instead of Delphi ini-files. The advantage of xml uasage is that you could extend the code by methods for iterating through the sections and their entries.
Read the rest of this entry »

How to Make Modal Form?

April 26th, 2010

Just a short notice how to make modal forms in Delphi. Assume, you have two Forms: AForm and BForm. AForm is your main form and you want now to call B as modal form (a modal form is a child form that requires the user to interact with it before it gets possible to return to the parent form). So inside your AForm you call BForm in the following way: Read the rest of this entry »

Exception Handling in Delphi

April 25th, 2010

Exceptions are a vital language structure of any modern programming language. This posting shows the usage of Delphi’s exceptions. Read the rest of this entry »

Problem with Synchronize-calls in DLLs

March 24th, 2010

If you use Synchronize() method for the synchronization of your thread with GUI, be ready to wonder, if this method does not work in DLLs. It’s a buggy feature of Delphi 2006. Peter Below offers a fix for this issue. The fix is to be found here. It is just one file that you add to your DLL. Afterwards Synchronize() works as expected.

Statistics for Programming Languages in February 2010.

March 1st, 2010

Today I found a nice article with the overview over modern programming languages and general tendencies in February 2010. I was pleasantly surprise, that Delphi is still in Top 10. So it is to be expected, the Delphi and IDEs for it will be supported also in the future.