source: cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptionsNewList.pas@ 1742

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 2.8 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 8/8/2007
2unit fOptionsNewList;
3
4interface
5
6uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, Dialogs,
7 Buttons, ComCtrls, ExtCtrls, OrFn, ORCtrls, DKLang;
8
9type
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
28procedure DialogOptionsNewList(fontsize: integer; var actiontype: string);
29
30var
31 frmOptionsNewList: TfrmOptionsNewList;
32
33implementation
34
35uses rOptions;
36
37{$R *.DFM}
38
39procedure DialogOptionsNewList(fontsize: integer; var actiontype: string);
40// create the form and make it modal, return an action
41var
42 frmOptionsNewList: TfrmOptionsNewList;
43begin
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;
57end;
58
59procedure TfrmOptionsNewList.btnOKClick(Sender: TObject);
60var
61 ok: boolean;
62begin
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;
88end;
89
90procedure TfrmOptionsNewList.txtNewListKeyPress(Sender: TObject;
91 var Key: Char);
92begin
93 if not (Key in ['A'..'Z', 'a'..'z', '0'..'9', #32, #8]) then
94 begin
95 Key := #0;
96 beep;
97 end;
98end;
99
100procedure TfrmOptionsNewList.txtNewListChange(Sender: TObject);
101begin
102 btnOK.Enabled := length(txtNewList.Text) > 3;
103end;
104
105end.
106
Note: See TracBrowser for help on using the repository browser.