[456] | 1 | unit fNoteIDParents;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[830] | 7 | fAutoSz, ORCtrls, ComCtrls, StdCtrls, ORFn, VA508AccessibilityManager;
|
---|
[456] | 8 |
|
---|
| 9 | type
|
---|
| 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 |
|
---|
| 24 | function SelectParentNodeFromList(ATree: TORTreeView): string;
|
---|
| 25 |
|
---|
| 26 | implementation
|
---|
| 27 |
|
---|
| 28 | {$R *.DFM}
|
---|
| 29 |
|
---|
| 30 | uses
|
---|
| 31 | uTIU, rTIU, uConst;
|
---|
| 32 |
|
---|
| 33 | function SelectParentNodeFromList(ATree: TORTreeView): string;
|
---|
| 34 | var
|
---|
| 35 | frmNoteIDParents: TfrmNoteIDParents;
|
---|
| 36 | i, AnImg: integer;
|
---|
| 37 | x: string;
|
---|
| 38 | tmpList: TStringList;
|
---|
| 39 | begin
|
---|
| 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);
|
---|
[830] | 56 | FastAssign(tmpList, frmNoteIDParents.lstIDParents.Items);
|
---|
[456] | 57 | frmNoteIDParents.ShowModal;
|
---|
| 58 | Result := frmNoteIDParents.FParentNode;
|
---|
| 59 | finally
|
---|
| 60 | tmpList.Free;
|
---|
| 61 | frmNoteIDParents.Release;
|
---|
| 62 | end;
|
---|
| 63 | end;
|
---|
| 64 |
|
---|
| 65 | procedure TfrmNoteIDParents.FormCreate(Sender: TObject);
|
---|
| 66 | begin
|
---|
| 67 | inherited;
|
---|
| 68 | FParentNode := '';
|
---|
| 69 | end;
|
---|
| 70 |
|
---|
| 71 | procedure TfrmNoteIDParents.cmdCancelClick(Sender: TObject);
|
---|
| 72 | begin
|
---|
| 73 | inherited;
|
---|
| 74 | FParentNode := '';
|
---|
| 75 | Close;
|
---|
| 76 | end;
|
---|
| 77 |
|
---|
| 78 | procedure TfrmNoteIDParents.cmdOKClick(Sender: TObject);
|
---|
| 79 | const
|
---|
| 80 | TX_ATTACH_FAILURE = 'Attachment failed';
|
---|
| 81 | var
|
---|
| 82 | WhyNot, ErrMsg: string;
|
---|
| 83 | begin
|
---|
| 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;
|
---|
| 95 | end;
|
---|
| 96 |
|
---|
| 97 | end.
|
---|