[456] | 1 | unit fTemplateObjects;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[829] | 7 | ORCtrls, StdCtrls, ExtCtrls, ComCtrls, ORFn, dShared, uTemplates, fBase508Form,
|
---|
| 8 | VA508AccessibilityManager;
|
---|
[456] | 9 |
|
---|
| 10 | type
|
---|
[829] | 11 | TfrmTemplateObjects = class(TfrmBase508Form)
|
---|
[456] | 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 |
|
---|
| 34 | implementation
|
---|
| 35 |
|
---|
| 36 | {$R *.DFM}
|
---|
| 37 |
|
---|
| 38 | procedure TfrmTemplateObjects.FormShow(Sender: TObject);
|
---|
| 39 | begin
|
---|
| 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;
|
---|
| 47 | end;
|
---|
| 48 |
|
---|
| 49 | procedure TfrmTemplateObjects.btnInsertClick(Sender: TObject);
|
---|
| 50 | begin
|
---|
| 51 | InsertObject;
|
---|
| 52 | end;
|
---|
| 53 |
|
---|
| 54 | procedure TfrmTemplateObjects.InsertObject;
|
---|
| 55 | var
|
---|
| 56 | cnt: integer;
|
---|
| 57 |
|
---|
| 58 | begin
|
---|
| 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;
|
---|
| 66 | end;
|
---|
| 67 |
|
---|
| 68 | procedure TfrmTemplateObjects.cboObjectsDblClick(Sender: TObject);
|
---|
| 69 | begin
|
---|
| 70 | InsertObject;
|
---|
| 71 | end;
|
---|
| 72 |
|
---|
| 73 | procedure TfrmTemplateObjects.btnCancelClick(Sender: TObject);
|
---|
| 74 | begin
|
---|
| 75 | Close;
|
---|
| 76 | end;
|
---|
| 77 |
|
---|
| 78 | procedure TfrmTemplateObjects.FormClose(Sender: TObject;
|
---|
| 79 | var Action: TCloseAction);
|
---|
| 80 | begin
|
---|
| 81 | Action := caHide;
|
---|
| 82 | end;
|
---|
| 83 |
|
---|
| 84 | procedure TfrmTemplateObjects.Setre(const Value: TRichEdit);
|
---|
| 85 | begin
|
---|
| 86 | Fre := Value;
|
---|
| 87 | UpdateStatus;
|
---|
| 88 | end;
|
---|
| 89 |
|
---|
| 90 | procedure TfrmTemplateObjects.UpdateStatus;
|
---|
| 91 | begin
|
---|
| 92 | btnInsert.Enabled := (not re.ReadOnly);
|
---|
| 93 | end;
|
---|
| 94 |
|
---|
| 95 | procedure TfrmTemplateObjects.btnRefreshClick(Sender: TObject);
|
---|
[829] | 96 | var
|
---|
| 97 | i: integer;
|
---|
| 98 | DoIt: boolean;
|
---|
[456] | 99 | begin
|
---|
[829] | 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);
|
---|
[456] | 116 | end;
|
---|
| 117 |
|
---|
| 118 | end.
|
---|
[829] | 119 |
|
---|