Open Folder Dialog in Delphi
Tuesday, November 1st, 2011The function below uses ShellAPI and implements Open Folder Dialog. This function works fine on Windows XP and Windows7 as well.
(more…)
The function below uses ShellAPI and implements Open Folder Dialog. This function works fine on Windows XP and Windows7 as well.
(more…)
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.
(more…)
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: (more…)
Exceptions are a vital language structure of any modern programming language. This posting shows the usage of Delphi’s exceptions. (more…)
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.
Listening to events in Delphi is pretty easy. In following I’d like to introduce two ways to list to events. Consider following example: (more…)