source: cprs/branches/tmg-cprs/TntWare/Delphi Unicode Controls/Source/TntDBLogDlg.pas@ 673

Last change on this file since 673 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 3.8 KB
Line 
1
2{*****************************************************************************}
3{ }
4{ Tnt Delphi Unicode Controls }
5{ http://www.tntware.com/delphicontrols/unicode/ }
6{ Version: 2.3.0 }
7{ }
8{ Copyright (c) 2002-2007, Troy Wolbrink (troy.wolbrink@tntware.com) }
9{ }
10{*****************************************************************************}
11
12unit TntDBLogDlg;
13
14{$INCLUDE TntCompilers.inc}
15
16interface
17
18uses
19 SysUtils, Windows, Messages, Classes, Graphics,
20 TntForms, TntStdCtrls, TntExtCtrls, StdCtrls, ExtCtrls, Controls;
21
22type
23 TTntLoginDialog = class(TTntForm)
24 Panel: TTntPanel;
25 Bevel: TTntBevel;
26 DatabaseName: TTntLabel;
27 OKButton: TTntButton;
28 CancelButton: TTntButton;
29 Panel1: TTntPanel;
30 Label1: TTntLabel;
31 Label2: TTntLabel;
32 Label3: TTntLabel;
33 Password: TTntEdit;
34 UserName: TTntEdit;
35 procedure FormShow(Sender: TObject);
36 end;
37
38{TNT-WARN LoginDialog}
39function TntLoginDialog(const ADatabaseName: WideString;
40 var AUserName, APassword: WideString): Boolean;
41
42{TNT-WARN LoginDialogEx}
43function TntLoginDialogEx(const ADatabaseName: WideString;
44 var AUserName, APassword: WideString; NameReadOnly: Boolean): Boolean;
45
46{TNT-WARN RemoteLoginDialog}
47function TntRemoteLoginDialog(var AUserName, APassword: WideString): Boolean;
48
49implementation
50
51{$R *.dfm}
52
53uses
54 Forms, VDBConsts;
55
56function TntLoginDialog(const ADatabaseName: WideString;
57 var AUserName, APassword: WideString): Boolean;
58begin
59 with TTntLoginDialog.Create(Application) do
60 try
61 DatabaseName.Caption := ADatabaseName;
62 UserName.Text := AUserName;
63 Result := False;
64 if AUserName = '' then ActiveControl := UserName;
65 if ShowModal = mrOk then
66 begin
67 AUserName := UserName.Text;
68 APassword := Password.Text;
69 Result := True;
70 end;
71 finally
72 Free;
73 end;
74end;
75
76function TntLoginDialogEx(const ADatabaseName: WideString;
77 var AUserName, APassword: WideString; NameReadOnly: Boolean): Boolean;
78begin
79 with TTntLoginDialog.Create(Application) do
80 try
81 DatabaseName.Caption := ADatabaseName;
82 UserName.Text := AUserName;
83 Result := False;
84 if NameReadOnly then
85 UserName.Enabled := False
86 else
87 if AUserName = '' then ActiveControl := UserName;
88 if ShowModal = mrOk then
89 begin
90 AUserName := UserName.Text;
91 APassword := Password.Text;
92 Result := True;
93 end;
94 finally
95 Free;
96 end;
97end;
98
99function TntRemoteLoginDialog(var AUserName, APassword: WideString): Boolean;
100begin
101 with TTntLoginDialog.Create(Application) do
102 try
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;
112 Result := False;
113 if AUserName = '' then ActiveControl := UserName;
114 if ShowModal = mrOk then
115 begin
116 AUserName := UserName.Text;
117 APassword := Password.Text;
118 Result := True;
119 end;
120 finally
121 Free;
122 end;
123end;
124
125{ TTntLoginDialog }
126
127procedure TTntLoginDialog.FormShow(Sender: TObject);
128begin
129 if (DatabaseName.Width + DatabaseName.Left) >= Panel.ClientWidth then
130 DatabaseName.Width := (Panel.ClientWidth - DatabaseName.Left) - 5;
131end;
132
133end.
Note: See TracBrowser for help on using the repository browser.