[Lazarus] Compile conditionals from Delphi do not work in Laz 1.6...

Dmitry Boyarintsev skalogryz.lists at gmail.com
Fri Jul 22 14:55:22 CEST 2016


On Thu, Jul 21, 2016 at 6:05 PM, Bo Berglund <bo.berglund at gmail.com> wrote:

> On Thu, 21 Jul 2016 17:24:00 -0400, Dmitry Boyarintsev
>
> Cannot check if it will work the same yet because of the conditional
> errors checking the Delphi version.
> But it seems like it does not have a property for the directory name,
> maybe I can use the FileName property instead?
>

If you're reading/assigning directory name in run-time (rather than design
time), you could (conditionally for FPC) add a class helper for
TSelectDirectoryDialog, emulating TFolderDialog the property

Something like this:

{$ifdef fpc}
  TSelectDirectoryDialogForFolderDialog = class helper for
TSelectDirectoryDialog
  private
    function GetDirName: string;
    procedure SetDirName(const AValue: string);
  public
    // the property name should match the one used for TFolderDialog
    // in order to prevent any changes in the code.
    property DirectoryName: string read GetDirName write SetDirName;
  end;
{$endif}

implementation
...
{$ifdef fpc}
function TSelectDirectoryDialogForFolderDialog.GetDirName: string;
begin
  Result:=Self.FileName;
end;

procedure TSelectDirectoryDialogForFolderDialogSetDirName(const AValue:
string);
begin
  Self.FileName:=Avalue;
end;
{$endif}


thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160722/5d0736be/attachment.html>


More information about the Lazarus mailing list