ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/DBAdmin/dlg/NewUserDlgUnit.pas
Revision: 158
Committed: Thu Mar 1 11:23:33 2018 UTC (6 years, 2 months ago) by tony
Content type: text/x-pascal
File size: 2192 byte(s)
Log Message:
Repository resync

File Contents

# User Rev Content
1 tony 158 (*
2     * NewUserDlgUnit.pas
3     * Copyright (C) 2018 Tony Whyman <tony@mwasoftware.co.uk>
4     *
5     * DBAdmin is free software: you can redistribute it and/or modify it
6     * under the terms of the GNU General Public License as published by the
7     * Free Software Foundation, either version 3 of the License, or
8     * (at your option) any later version.
9     *
10     * DBAdmin is distributed in the hope that it will be useful, but
11     * WITHOUT ANY WARRANTY; without even the implied warranty of
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13     * See the GNU General Public License for more details.
14     *
15     * You should have received a copy of the GNU General Public License along
16     * with this program. If not, see <http://www.gnu.org/licenses/>.
17     *)
18     unit NewUserDlgUnit;
19    
20     {$mode objfpc}{$H+}
21    
22     interface
23    
24     uses
25     Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
26     StdCtrls;
27    
28     type
29    
30     { TNewUserDlg }
31    
32     TNewUserDlg = class(TForm)
33     Bevel1: TBevel;
34     Button1: TButton;
35     Button2: TButton;
36     Edit1: TEdit;
37     Edit2: TEdit;
38     Edit3: TEdit;
39     Label1: TLabel;
40     Label2: TLabel;
41     Label3: TLabel;
42     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
43     procedure FormShow(Sender: TObject);
44     private
45    
46     public
47     function ShowModal(var UserName, Password: string): TModalResult;
48     end;
49    
50     var
51     NewUserDlg: TNewUserDlg;
52    
53     implementation
54    
55     {$R *.lfm}
56    
57    
58     { TNewUserDlg }
59    
60     procedure TNewUserDlg.FormShow(Sender: TObject);
61     begin
62     Edit1.SetFocus
63     end;
64    
65     procedure TNewUserDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction);
66     begin
67     if ModalResult = mrOK then
68     begin
69     if Edit1.Text = '' then
70     begin
71     MessageDlg('A User Name must be given',mtError,[mbOK],0);
72     CloseAction := caNone;
73     end
74     else
75     if Edit2.Text <> Edit3.Text then
76     begin
77     MessageDlg('Passwords do not match',mtError,[mbOK],0);
78     CloseAction := caNone;
79     end;
80     end;
81     end;
82    
83     function TNewUserDlg.ShowModal(var UserName, Password: string): TModalResult;
84     begin
85     Edit1.Text := '';
86     Edit2.Text := '';
87     Edit3.Text := '';
88     Result := inherited ShowModal;
89     if Result = mrOK then
90     begin
91     UserName := Edit1.Text;
92     Password := Edit2.Text;
93     end;
94     end;
95    
96     end.
97