source: cprs/branches/tmg-cprs/CPRS-Chart/Templates/fTemplateObjects.pas@ 1725

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

Initial upload of TMG-CPRS 1.0.26.69

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