1 |
tony |
143 |
(* |
2 |
|
|
* IBX For Lazarus (Firebird Express) |
3 |
|
|
* |
4 |
|
|
* The contents of this file are subject to the Initial Developer's |
5 |
|
|
* Public License Version 1.0 (the "License"); you may not use this |
6 |
|
|
* file except in compliance with the License. You may obtain a copy |
7 |
|
|
* of the License here: |
8 |
|
|
* |
9 |
|
|
* http://www.firebirdsql.org/index.php?op=doc&id=idpl |
10 |
|
|
* |
11 |
|
|
* Software distributed under the License is distributed on an "AS |
12 |
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
13 |
|
|
* implied. See the License for the specific language governing rights |
14 |
|
|
* and limitations under the License. |
15 |
|
|
* |
16 |
|
|
* The Initial Developer of the Original Code is Tony Whyman. |
17 |
|
|
* |
18 |
|
|
* The Original Code is (C) 2015 Tony Whyman, MWA Software |
19 |
|
|
* (http://www.mwasoftware.co.uk). |
20 |
|
|
* |
21 |
|
|
* All Rights Reserved. |
22 |
|
|
* |
23 |
|
|
* Contributor(s): ______________________________________. |
24 |
|
|
* |
25 |
|
|
*) |
26 |
|
|
|
27 |
tony |
37 |
unit Unit2; |
28 |
|
|
|
29 |
|
|
{$mode objfpc}{$H+} |
30 |
|
|
|
31 |
|
|
interface |
32 |
|
|
|
33 |
|
|
uses |
34 |
|
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, db, |
35 |
tony |
315 |
DBTreeView, IBTreeView, IBQuery; |
36 |
tony |
37 |
|
37 |
|
|
type |
38 |
|
|
|
39 |
|
|
{ TSelectDeptDlg } |
40 |
|
|
|
41 |
|
|
TSelectDeptDlg = class(TForm) |
42 |
|
|
Button1: TButton; |
43 |
|
|
Button2: TButton; |
44 |
|
|
DataSource1: TDataSource; |
45 |
|
|
Depts: TIBQuery; |
46 |
|
|
DeptsTreeView: TIBTreeView; |
47 |
|
|
Label1: TLabel; |
48 |
|
|
procedure DeptsTreeViewDblClick(Sender: TObject); |
49 |
|
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
50 |
|
|
procedure FormShow(Sender: TObject); |
51 |
|
|
private |
52 |
|
|
{ private declarations } |
53 |
|
|
FDeptKeyPath: string; |
54 |
|
|
FDept_no: string; |
55 |
|
|
public |
56 |
|
|
{ public declarations } |
57 |
|
|
function ShowModal(DeptKeyPath: string; var Dept_no: string): TModalResult; |
58 |
|
|
end; |
59 |
|
|
|
60 |
|
|
var |
61 |
|
|
SelectDeptDlg: TSelectDeptDlg; |
62 |
|
|
|
63 |
|
|
implementation |
64 |
|
|
|
65 |
|
|
{$R *.lfm} |
66 |
|
|
|
67 |
|
|
{ TSelectDeptDlg } |
68 |
|
|
|
69 |
|
|
procedure TSelectDeptDlg.FormShow(Sender: TObject); |
70 |
|
|
begin |
71 |
|
|
Depts.Active := true; |
72 |
|
|
if FDeptKeyPath <> '' then |
73 |
|
|
DeptsTreeView.FindNode(StrIntListToVar(FDeptKeyPath),true); {Find and Select Current Dept} |
74 |
|
|
end; |
75 |
|
|
|
76 |
|
|
function TSelectDeptDlg.ShowModal(DeptKeyPath: string; var Dept_no: string |
77 |
|
|
): TModalResult; |
78 |
|
|
begin |
79 |
|
|
FDeptKeyPath := DeptKeyPath; |
80 |
|
|
Result := inherited ShowModal; |
81 |
|
|
Dept_no := FDept_no; |
82 |
|
|
end; |
83 |
|
|
|
84 |
|
|
procedure TSelectDeptDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction); |
85 |
|
|
begin |
86 |
|
|
FDept_no := ''; |
87 |
|
|
if assigned(DeptsTreeView.Selected) then |
88 |
|
|
FDept_no := TIBTreeNode(DeptsTreeView.Selected).KeyValue; |
89 |
|
|
Depts.Active := false |
90 |
|
|
end; |
91 |
|
|
|
92 |
|
|
procedure TSelectDeptDlg.DeptsTreeViewDblClick(Sender: TObject); |
93 |
|
|
begin |
94 |
|
|
ModalResult := mrOK; |
95 |
|
|
end; |
96 |
|
|
|
97 |
|
|
end. |
98 |
|
|
|