2 {*****************************************************************************}
4 { Tnt Delphi Unicode Controls }
5 { http://www.tntware.com/delphicontrols/unicode/ }
8 { Copyright (c) 2002-2007, Troy Wolbrink (troy.wolbrink@tntware.com) }
10 {*****************************************************************************}
14 {$INCLUDE TntCompilers.inc}
19 SysUtils
, Windows
, Messages
, Classes
, Graphics
,
20 TntForms
, TntStdCtrls
, TntExtCtrls
, StdCtrls
, ExtCtrls
, Controls
;
23 TTntLoginDialog
= class(TTntForm
)
26 DatabaseName
: TTntLabel
;
28 CancelButton
: TTntButton
;
35 procedure FormShow(Sender
: TObject
);
38 {TNT-WARN LoginDialog}
39 function TntLoginDialog(const ADatabaseName
: WideString
;
40 var AUserName
, APassword
: WideString
): Boolean;
42 {TNT-WARN LoginDialogEx}
43 function TntLoginDialogEx(const ADatabaseName
: WideString
;
44 var AUserName
, APassword
: WideString
; NameReadOnly
: Boolean): Boolean;
46 {TNT-WARN RemoteLoginDialog}
47 function TntRemoteLoginDialog(var AUserName
, APassword
: WideString
): Boolean;
56 function TntLoginDialog(const ADatabaseName
: WideString
;
57 var AUserName
, APassword
: WideString
): Boolean;
59 with TTntLoginDialog
.Create(Application
) do
61 DatabaseName
.Caption
:= ADatabaseName
;
62 UserName
.Text := AUserName
;
64 if AUserName
= '' then ActiveControl
:= UserName
;
65 if ShowModal
= mrOk
then
67 AUserName
:= UserName
.Text;
68 APassword
:= Password
.Text;
76 function TntLoginDialogEx(const ADatabaseName
: WideString
;
77 var AUserName
, APassword
: WideString
; NameReadOnly
: Boolean): Boolean;
79 with TTntLoginDialog
.Create(Application
) do
81 DatabaseName
.Caption
:= ADatabaseName
;
82 UserName
.Text := AUserName
;
85 UserName
.Enabled
:= False
87 if AUserName
= '' then ActiveControl
:= UserName
;
88 if ShowModal
= mrOk
then
90 AUserName
:= UserName
.Text;
91 APassword
:= Password
.Text;
99 function TntRemoteLoginDialog(var AUserName
, APassword
: WideString
): Boolean;
101 with TTntLoginDialog
.Create(Application
) do
103 Caption
:= SRemoteLogin
;
104 Bevel
.Visible
:= False;
105 DatabaseName
.Visible
:= False;
106 Label3
.Visible
:= False;
107 Panel
.Height
:= Panel
.Height
- Bevel
.Top
;
108 OKButton
.Top
:= OKButton
.Top
- Bevel
.Top
;
109 CancelButton
.Top
:= CancelButton
.Top
- Bevel
.Top
;
110 Height
:= Height
- Bevel
.Top
;
111 UserName
.Text := AUserName
;
113 if AUserName
= '' then ActiveControl
:= UserName
;
114 if ShowModal
= mrOk
then
116 AUserName
:= UserName
.Text;
117 APassword
:= Password
.Text;
127 procedure TTntLoginDialog
.FormShow(Sender
: TObject
);
129 if (DatabaseName
.Width
+ DatabaseName
.Left
) >= Panel
.ClientWidth
then
130 DatabaseName
.Width
:= (Panel
.ClientWidth
- DatabaseName
.Left
) - 5;