source: cprs/branches/tmg-cprs/CPRS-Chart/fNoteIDParents.pas@ 1248

Last change on this file since 1248 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/28/2007
2unit fNoteIDParents;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fAutoSz, ORCtrls, ComCtrls, StdCtrls, ORFn, DKLang;
9
10type
11 TfrmNoteIDParents = class(TfrmAutoSz)
12 cmdOK: TButton;
13 cmdCancel: TButton;
14 lstIDParents: TORListBox;
15 lblSelectParent: TLabel;
16 procedure FormCreate(Sender: TObject);
17 procedure cmdCancelClick(Sender: TObject);
18 procedure cmdOKClick(Sender: TObject);
19 private
20 //kt Begin Mod (change Consts to Vars) 8/28/2007
21 TX_ATTACH_FAILURE : string; //kt
22 //kt End Mod -------------------
23 FParentNode: string;
24 public
25 { Public declarations }
26 end;
27
28function SelectParentNodeFromList(ATree: TORTreeView): string;
29
30implementation
31
32{$R *.DFM}
33
34uses
35 uTIU, rTIU, uConst;
36
37function SelectParentNodeFromList(ATree: TORTreeView): string;
38var
39 frmNoteIDParents: TfrmNoteIDParents;
40 i, AnImg: integer;
41 x: string;
42 tmpList: TStringList;
43begin
44 frmNoteIDParents := TfrmNoteIDParents.Create(Application);
45 tmpList := TStringList.Create;
46 try
47 ResizeFormToFont(TForm(frmNoteIDParents));
48 for i := 0 to ATree.Items.Count - 1 do
49 begin
50 AnImg := TORTreeNode(ATree.Items.Item[i]).ImageIndex;
51 if AnImg in [IMG_SINGLE, IMG_PARENT,IMG_IDNOTE_SHUT, IMG_IDNOTE_OPEN,
52 IMG_IDPAR_ADDENDA_SHUT, IMG_IDPAR_ADDENDA_OPEN] then
53 begin
54 x := TORTreeNode(ATree.Items.Item[i]).Stringdata;
55 tmpList.Add(Piece(x, U, 1) + U + MakeNoteDisplayText(x) + U + Piece(x, U, 3));
56 end;
57 end;
58 SortByPiece(tmpList, U, 3);
59 InvertStringList(tmpList);
60 frmNoteIDParents.lstIDParents.Items.Assign(tmpList);
61 frmNoteIDParents.ShowModal;
62 Result := frmNoteIDParents.FParentNode;
63 finally
64 tmpList.Free;
65 frmNoteIDParents.Release;
66 end;
67end;
68
69procedure TfrmNoteIDParents.FormCreate(Sender: TObject);
70begin
71 inherited;
72 FParentNode := '';
73end;
74
75procedure TfrmNoteIDParents.cmdCancelClick(Sender: TObject);
76begin
77 inherited;
78 FParentNode := '';
79 Close;
80end;
81
82procedure TfrmNoteIDParents.cmdOKClick(Sender: TObject);
83//const
84//TX_ATTACH_FAILURE = 'Attachment failed'; <-- original line. //kt 8/28/2007
85var
86 WhyNot, ErrMsg: string;
87 TX_ATTACH_FAILURE : string; //kt
88begin
89 inherited;
90 TX_ATTACH_FAILURE := DKLangConstW('fNoteIDParents_Attachment_failed');
91 ErrMsg := '';
92 if not CanReceiveAttachment(lstIDParents.ItemID, WhyNot) then
93 ErrMsg := ErrMsg + WhyNot;
94 if ErrMsg <> '' then
95 begin
96 InfoBox(ErrMsg, TX_ATTACH_FAILURE, MB_OK);
97 Exit;
98 end;
99 FParentNode := lstIDParents.ItemID;
100 Close;
101end;
102
103end.
Note: See TracBrowser for help on using the repository browser.