I'd like to assign the directory path the user browsed to a data-bound edit field, only after the dialog has executed and only if the user did not cancel the dialog execution. How would I do this? I can't find any documentation on using this control.
I also wondered how the OnShowDirectoryDialog event is used.
Thanks for your help,
Ric
The code below works, is it the correct way? Also still wondering about OnShowDirectoryDialog.
Thanks,
Ric
procedure TfrmStore.adePath1DialogClose(Sender: TObject; NewDirectory: string;
OK: Boolean);
begin
if OK then
begin
dsStore.DataSet.Edit;
dsStore.DataSet.FieldByName('Path1').AsString := NewDirectory;
try
dsStore.DataSet.Post;
dbePath1.Refresh;
except
on e: exception do
begin
dsStore.DataSet.Cancel;
showMessage('Saving Path1 failed:' + sLineBreak + e.Message);
end;
end;
end;
end;
This looks like a correct implementation.
OnShowDirectoryDialog is triggered just before the directory picker dialog is displayed and can be used to perform customizations when needed just before the dialog is shown.
Thanks Bruno