1 | //kt -- Modified with SourceScanner on 8/28/2007
|
---|
2 | unit fNoteIDParents;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
8 | fAutoSz, ORCtrls, ComCtrls, StdCtrls, ORFn, DKLang;
|
---|
9 |
|
---|
10 | type
|
---|
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 |
|
---|
28 | function SelectParentNodeFromList(ATree: TORTreeView): string;
|
---|
29 |
|
---|
30 | implementation
|
---|
31 |
|
---|
32 | {$R *.DFM}
|
---|
33 |
|
---|
34 | uses
|
---|
35 | uTIU, rTIU, uConst;
|
---|
36 |
|
---|
37 | function SelectParentNodeFromList(ATree: TORTreeView): string;
|
---|
38 | var
|
---|
39 | frmNoteIDParents: TfrmNoteIDParents;
|
---|
40 | i, AnImg: integer;
|
---|
41 | x: string;
|
---|
42 | tmpList: TStringList;
|
---|
43 | begin
|
---|
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;
|
---|
67 | end;
|
---|
68 |
|
---|
69 | procedure TfrmNoteIDParents.FormCreate(Sender: TObject);
|
---|
70 | begin
|
---|
71 | inherited;
|
---|
72 | FParentNode := '';
|
---|
73 | end;
|
---|
74 |
|
---|
75 | procedure TfrmNoteIDParents.cmdCancelClick(Sender: TObject);
|
---|
76 | begin
|
---|
77 | inherited;
|
---|
78 | FParentNode := '';
|
---|
79 | Close;
|
---|
80 | end;
|
---|
81 |
|
---|
82 | procedure TfrmNoteIDParents.cmdOKClick(Sender: TObject);
|
---|
83 | //const
|
---|
84 | //TX_ATTACH_FAILURE = 'Attachment failed'; <-- original line. //kt 8/28/2007
|
---|
85 | var
|
---|
86 | WhyNot, ErrMsg: string;
|
---|
87 | TX_ATTACH_FAILURE : string; //kt
|
---|
88 | begin
|
---|
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;
|
---|
101 | end;
|
---|
102 |
|
---|
103 | end.
|
---|