1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
{*****************************************************************************}
{ }
{ Tnt Delphi Unicode Controls }
{ http://tnt.ccci.org/delphi_unicode_controls/ }
{ Version: 2.1.11 }
{ }
{ Copyright (c) 2002-2004, Troy Wolbrink (troy.wolbrink@ccci.org) }
{ }
{*****************************************************************************}
unit TntDBLogDlg;
{$INCLUDE TntCompilers.inc}
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
TntForms, TntStdCtrls, TntExtCtrls, StdCtrls, ExtCtrls;
type
TTntLoginDialog = class(TTntForm{TNT-ALLOW TTntForm})
Panel: TTntPanel;
Bevel: TTntBevel;
DatabaseName: TTntLabel;
OKButton: TTntButton;
CancelButton: TTntButton;
Panel1: TTntPanel;
Label1: TTntLabel;
Label2: TTntLabel;
Label3: TTntLabel;
Password: TTntEdit;
UserName: TTntEdit;
procedure FormShow(Sender: TObject);
end;
{TNT-WARN LoginDialog}
function TntLoginDialog(const ADatabaseName: WideString;
var AUserName, APassword: WideString): Boolean;
{TNT-WARN LoginDialogEx}
function TntLoginDialogEx(const ADatabaseName: WideString;
var AUserName, APassword: WideString; NameReadOnly: Boolean): Boolean;
{TNT-WARN RemoteLoginDialog}
function TntRemoteLoginDialog(var AUserName, APassword: WideString): Boolean;
implementation
{$R *.dfm}
uses
Forms {$IFDEF COMPILER_6_UP}, VDBConsts {$ENDIF};
function TntLoginDialog(const ADatabaseName: WideString;
var AUserName, APassword: WideString): Boolean;
begin
with TTntLoginDialog.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 TntLoginDialogEx(const ADatabaseName: WideString;
var AUserName, APassword: WideString; NameReadOnly: Boolean): Boolean;
begin
with TTntLoginDialog.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;
{$IFNDEF COMPILER_6_UP}
resourcestring
SRemoteLogin = 'Remote Login';
{$ENDIF}
function TntRemoteLoginDialog(var AUserName, APassword: WideString): Boolean;
begin
with TTntLoginDialog.Create(Application) do
try
Caption := SRemoteLogin;
Bevel.Visible := False;
DatabaseName.Visible := False;
Label3.Visible := False;
Panel.Height := Panel.Height - Bevel.Top;
OKButton.Top := OKButton.Top - Bevel.Top;
CancelButton.Top := CancelButton.Top - Bevel.Top;
Height := Height - Bevel.Top;
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;
{ TTntLoginDialog }
procedure TTntLoginDialog.FormShow(Sender: TObject);
begin
if (DatabaseName.Width + DatabaseName.Left) >= Panel.ClientWidth then
DatabaseName.Width := (Panel.ClientWidth - DatabaseName.Left) - 5;
end;
end.
|