{$I ABSVer.inc}

unit ABSPasswordDialog;

interface

uses
  Windows, Messages, SysUtils, Classes, 
{$IFNDEF D16H}
Graphics, Controls, Forms, Dialogs, StdCtrls
{$ELSE}
vcl.Graphics, vcl.Controls, vcl.Forms, vcl.Dialogs, vcl.StdCtrls
{$ENDIF}
;

type
  TABSPassDialog = class(TForm)
    Label1: TLabel;
    Pass: TEdit;
    cbOk: TButton;
    cbCancel: TButton;
    lbName: TLabel;
    procedure cbOkClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    FDataBase: TObject;
  end;

var
  PassDialog: TABSPassDialog;

function PasswordDialog(DataBase: TObject; DatabaseName: string = ''): Boolean;

implementation

uses ABSMain;
{$R *.DFM}

function PasswordDialog(DataBase: TObject; DatabaseName: string = ''): Boolean;
begin
 with TABSPassDialog.Create(Application) do
  begin
   try
    Pass.Text := '';
    FDataBase := DataBase;
    lbName.Caption := DataBaseName;
    Result := (ShowModal = mrOk);
   finally
    Free;
   end;
  end;
end;


procedure TABSPassDialog.cbOkClick(Sender: TObject);
begin
 (FDataBase as TABSDatabase).Password := Pass.Text;
end;

end.
