home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 April
/
Chip_1997-04_cd.bin
/
prezent
/
cb
/
data.z
/
DBLOGDLG.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-01-16
|
2KB
|
85 lines
{*******************************************************}
{ }
{ Delphi Visual Component Library }
{ }
{ Copyright (c) 1995,96 Borland International }
{ }
{*******************************************************}
unit DBLogDlg;
{$P+}
interface
uses SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, StdCtrls, ExtCtrls;
type
TLoginDialog = class(TForm)
Panel: TPanel;
Bevel: TBevel;
DatabaseName: TLabel;
UserName: TEdit;
Password: TEdit;
OKButton: TButton;
CancelButton: TButton;
end;
function LoginDialog(const ADatabaseName: string;
var AUserName, APassword: string): Boolean;
function LoginDialogEx(const ADatabaseName: string;
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
implementation
{$R *.DFM}
function LoginDialog(const ADatabaseName: string;
var AUserName, APassword: string): Boolean;
begin
with TLoginDialog.Create(Application) do
try
DatabaseName.Caption := ADatabaseName;
UserName.Text := AUserName;
Result := False;
if AUserName = '' then ActiveControl := UserName;
if ShowModal = mrOk then
begin
AUserName := UserName.Text;
APassword := Password.Text;
Result := True;
end;
finally
Free;
end;
end;
function LoginDialogEx(const ADatabaseName: string;
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
begin
with TLoginDialog.Create(Application) do
try
DatabaseName.Caption := ADatabaseName;
UserName.Text := AUserName;
Result := False;
if NameReadOnly then
UserName.Enabled := False
else
if AUserName = '' then ActiveControl := UserName;
if ShowModal = mrOk then
begin
AUserName := UserName.Text;
APassword := Password.Text;
Result := True;
end;
finally
Free;
end;
end;
end.