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

File Contents

# User Rev Content
1 tony 158 (*
2     * ChgPasswordDlgUnit.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 ChgPasswordDlgUnit;
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     { TChgPasswordDlg }
31    
32     TChgPasswordDlg = class(TForm)
33     Bevel1: TBevel;
34     Button1: TButton;
35     Button2: TButton;
36     Edit2: TEdit;
37     Edit3: TEdit;
38     Label2: TLabel;
39     Label3: TLabel;
40     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
41     procedure FormShow(Sender: TObject);
42     private
43    
44     public
45     function ShowModal(var Password: string): TModalResult;
46     end;
47    
48     var
49     ChgPasswordDlg: TChgPasswordDlg;
50    
51     implementation
52    
53     {$R *.lfm}
54    
55     { TChgPasswordDlg }
56    
57     procedure TChgPasswordDlg.FormShow(Sender: TObject);
58     begin
59     Edit2.SetFocus;
60     end;
61    
62     procedure TChgPasswordDlg.FormClose(Sender: TObject;
63     var CloseAction: TCloseAction);
64     begin
65     if ModalResult = mrOK then
66     begin
67     if Edit2.Text <> Edit3.Text then
68     begin
69     MessageDlg('Passwords do not match',mtError,[mbOK],0);
70     CloseAction := caNone;
71     end;
72     end;
73     end;
74    
75     function TChgPasswordDlg.ShowModal(var Password: string): TModalResult;
76     begin
77     Edit2.Text := '';
78     Edit3.Text := '';
79     Result := inherited ShowModal;
80     if Result = mrOK then
81     Password := Edit2.Text;
82     end;
83    
84     end.
85