Open Folder Dialog in Delphi
November 1st, 2011The 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 »
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 »
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.
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 »
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 »
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 »
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.
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.