source: cprs/trunk/CPRS-Chart/Options/fOptionsNewList.pas@ 1562

Last change on this file since 1562 was 829, checked in by Kevin Toppenberg, 14 years ago

Upgrade to version 27

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