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