source: cprs/trunk/CPRS-Chart/Templates/fTemplateObjects.pas

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

Upgrade to version 27

File size: 3.1 KB
Line 
1unit fTemplateObjects;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 ORCtrls, StdCtrls, ExtCtrls, ComCtrls, ORFn, dShared, uTemplates, fBase508Form,
8 VA508AccessibilityManager;
9
10type
11 TfrmTemplateObjects = class(TfrmBase508Form)
12 cboObjects: TORComboBox;
13 pnlBottom: TPanel;
14 btnCancel: TButton;
15 btnInsert: TButton;
16 btnRefresh: TButton;
17 procedure FormShow(Sender: TObject);
18 procedure btnInsertClick(Sender: TObject);
19 procedure cboObjectsDblClick(Sender: TObject);
20 procedure btnCancelClick(Sender: TObject);
21 procedure btnRefreshClick(Sender: TObject);
22 procedure FormClose(Sender: TObject; var Action: TCloseAction);
23 private
24 Fre: TRichEdit;
25 FAutoLongLines: TNotifyEvent;
26 procedure InsertObject;
27 procedure Setre(const Value: TRichEdit);
28 public
29 procedure UpdateStatus;
30 property re: TRichEdit read Fre write Setre;
31 property AutoLongLines: TNotifyEvent read FAutoLongLines write FAutoLongLines;
32 end;
33
34implementation
35
36{$R *.DFM}
37
38procedure TfrmTemplateObjects.FormShow(Sender: TObject);
39begin
40 ResizeAnchoredFormToFont(self);
41 //ResizeAnchoredFormToFont doesn't work right on the button positions for some reason.
42 btnCancel.Left := pnlBottom.ClientWidth - btnCancel.Width;
43 btnInsert.Left := btnCancel.Left - btnInsert.Width - 5;
44 btnRefresh.Left := btnInsert.Left - btnRefresh.Width - 5;
45 cboObjects.SelectAll;
46 cboObjects.SetFocus;
47end;
48
49procedure TfrmTemplateObjects.btnInsertClick(Sender: TObject);
50begin
51 InsertObject;
52end;
53
54procedure TfrmTemplateObjects.InsertObject;
55var
56 cnt: integer;
57
58begin
59 if(not Fre.ReadOnly) and (cboObjects.ItemIndex >= 0) then
60 begin
61 cnt := Fre.Lines.Count;
62 Fre.SelText := '|'+Piece(cboObjects.Items[cboObjects.ItemIndex],U,3)+'|';
63 if(assigned(FAutoLongLines) and (cnt <> FRe.Lines.Count)) then
64 FAutoLongLines(Self);
65 end;
66end;
67
68procedure TfrmTemplateObjects.cboObjectsDblClick(Sender: TObject);
69begin
70 InsertObject;
71end;
72
73procedure TfrmTemplateObjects.btnCancelClick(Sender: TObject);
74begin
75 Close;
76end;
77
78procedure TfrmTemplateObjects.FormClose(Sender: TObject;
79 var Action: TCloseAction);
80begin
81 Action := caHide;
82end;
83
84procedure TfrmTemplateObjects.Setre(const Value: TRichEdit);
85begin
86 Fre := Value;
87 UpdateStatus;
88end;
89
90procedure TfrmTemplateObjects.UpdateStatus;
91begin
92 btnInsert.Enabled := (not re.ReadOnly);
93end;
94
95procedure TfrmTemplateObjects.btnRefreshClick(Sender: TObject);
96var
97 i: integer;
98 DoIt: boolean;
99begin
100 cboObjects.Clear;
101 dmodShared.RefreshObject := true;
102 dmodShared.LoadTIUObjects;
103 //---------- CQ #8665 - RV ----------------
104 DoIt := TRUE;
105 UpdatePersonalObjects;
106 if uPersonalObjects.Count > 0 then
107 begin
108 DoIt := FALSE;
109 for i := 0 to dmodShared.TIUObjects.Count-1 do
110 if uPersonalObjects.IndexOf(Piece(dmodShared.TIUObjects[i],U,2)) >= 0 then
111 cboObjects.Items.Add(dmodShared.TIUObjects[i]);
112 end;
113 if DoIt then
114 //---------- end CQ #8665 ------------------
115 cboObjects.Items.Assign(dmodShared.TIUObjects);
116end;
117
118end.
119
Note: See TracBrowser for help on using the repository browser.