source: cprs/trunk/CPRS-Chart/fNoteIDParents.pas@ 1166

Last change on this file since 1166 was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

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