1 | unit fOptionsNewList;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, Dialogs,
|
---|
6 | Buttons, ComCtrls, ExtCtrls, OrFn, ORCtrls, fBase508Form,
|
---|
7 | VA508AccessibilityManager;
|
---|
8 |
|
---|
9 | type
|
---|
10 | TfrmOptionsNewList = class(TfrmBase508Form)
|
---|
11 | pnlBottom: TPanel;
|
---|
12 | btnOK: TButton;
|
---|
13 | btnCancel: TButton;
|
---|
14 | txtNewList: TCaptionEdit;
|
---|
15 | lblEnter: TLabel;
|
---|
16 | lblNew: TLabel;
|
---|
17 | Label1: TLabel;
|
---|
18 | grpVisibility: TRadioGroup;
|
---|
19 | procedure btnOKClick(Sender: TObject);
|
---|
20 | procedure txtNewListKeyPress(Sender: TObject; var Key: Char);
|
---|
21 | procedure txtNewListChange(Sender: TObject);
|
---|
22 | procedure FormCreate(Sender: TObject);
|
---|
23 | private
|
---|
24 | { Private declarations }
|
---|
25 | FNewList: string;
|
---|
26 | public
|
---|
27 | { Public declarations }
|
---|
28 | end;
|
---|
29 |
|
---|
30 | procedure DialogOptionsNewList(fontsize: integer; var actiontype: string);
|
---|
31 |
|
---|
32 | var
|
---|
33 | frmOptionsNewList: TfrmOptionsNewList;
|
---|
34 |
|
---|
35 | implementation
|
---|
36 |
|
---|
37 | uses rOptions, VAUtils;
|
---|
38 |
|
---|
39 | {$R *.DFM}
|
---|
40 |
|
---|
41 | procedure DialogOptionsNewList(fontsize: integer; var actiontype: string);
|
---|
42 | // create the form and make it modal, return an action
|
---|
43 | var
|
---|
44 | frmOptionsNewList: TfrmOptionsNewList;
|
---|
45 | begin
|
---|
46 | frmOptionsNewList := TfrmOptionsNewList.Create(Application);
|
---|
47 | actiontype := '';
|
---|
48 | try
|
---|
49 | with frmOptionsNewList do
|
---|
50 | begin
|
---|
51 | Position := poScreenCenter;
|
---|
52 | ResizeAnchoredFormToFont(frmOptionsNewList);
|
---|
53 | ShowModal;
|
---|
54 | actiontype := FNewList;
|
---|
55 | end;
|
---|
56 | finally
|
---|
57 | frmOptionsNewList.Release;
|
---|
58 | end;
|
---|
59 | end;
|
---|
60 |
|
---|
61 | procedure TfrmOptionsNewList.btnOKClick(Sender: TObject);
|
---|
62 | var
|
---|
63 | ok: boolean;
|
---|
64 | begin
|
---|
65 | ok := false;
|
---|
66 | with txtNewList do
|
---|
67 | begin
|
---|
68 | if (length(Text) < 3) or (length(Text) > 30) then
|
---|
69 | ShowMsg('Enter a valid name.')
|
---|
70 | else if not ContainsAlpha(txtNewList.Text[1]) then
|
---|
71 | ShowMsg('Enter a valid name.')
|
---|
72 | else
|
---|
73 | begin
|
---|
74 | FNewList := rpcNewList(Text, grpVisibility.ItemIndex);
|
---|
75 | if Piece(FNewList, '^', 1) = '' then
|
---|
76 | ShowMsg('Enter a valid name. ' + Piece(FNewList, '^', 2))
|
---|
77 | else
|
---|
78 | ok := true;
|
---|
79 | end;
|
---|
80 | if ok then Close
|
---|
81 | else
|
---|
82 | begin
|
---|
83 | Text := '';
|
---|
84 | SetFocus;
|
---|
85 | end;
|
---|
86 | end;
|
---|
87 | end;
|
---|
88 |
|
---|
89 | procedure TfrmOptionsNewList.txtNewListKeyPress(Sender: TObject;
|
---|
90 | var Key: Char);
|
---|
91 | begin
|
---|
92 | if not (Key in ['A'..'Z', 'a'..'z', '0'..'9', #32, #8]) then
|
---|
93 | begin
|
---|
94 | Key := #0;
|
---|
95 | beep;
|
---|
96 | end;
|
---|
97 | end;
|
---|
98 |
|
---|
99 | procedure TfrmOptionsNewList.FormCreate(Sender: TObject);
|
---|
100 | begin
|
---|
101 | inherited;
|
---|
102 | grpVisibility.ItemIndex := 0;
|
---|
103 | txtNewList.Text := '';
|
---|
104 | end;
|
---|
105 |
|
---|
106 | procedure TfrmOptionsNewList.txtNewListChange(Sender: TObject);
|
---|
107 | begin
|
---|
108 | btnOK.Enabled := length(txtNewList.Text) > 3;
|
---|
109 | end;
|
---|
110 |
|
---|
111 | end.
|
---|
112 |
|
---|