1 |
tony |
23 |
unit Unit4; |
2 |
|
|
|
3 |
|
|
{$mode objfpc}{$H+} |
4 |
|
|
|
5 |
|
|
interface |
6 |
|
|
|
7 |
|
|
uses |
8 |
|
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, |
9 |
|
|
StdCtrls, db, IBQuery, IBLookupComboEditBox; |
10 |
|
|
|
11 |
|
|
type |
12 |
|
|
|
13 |
|
|
{ TEditLocation } |
14 |
|
|
|
15 |
|
|
TEditLocation = class(TForm) |
16 |
|
|
Bevel1: TBevel; |
17 |
|
|
Button1: TButton; |
18 |
|
|
Button2: TButton; |
19 |
|
|
Countries: TIBQuery; |
20 |
|
|
CountrySource: TDataSource; |
21 |
|
|
IBLookupComboEditBox2: TIBLookupComboEditBox; |
22 |
|
|
procedure CountriesAfterOpen(DataSet: TDataSet); |
23 |
|
|
procedure CountriesBeforeOpen(DataSet: TDataSet); |
24 |
|
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
25 |
|
|
procedure FormShow(Sender: TObject); |
26 |
|
|
private |
27 |
|
|
{ private declarations } |
28 |
|
|
FGrade: integer; |
29 |
|
|
FCountry: string; |
30 |
|
|
FJobCode: string; |
31 |
|
|
public |
32 |
|
|
{ public declarations } |
33 |
|
|
function ShowModal(Grade: integer; JobCode: string; var Country: string |
34 |
|
|
): TModalResult; |
35 |
|
|
end; |
36 |
|
|
|
37 |
|
|
var |
38 |
|
|
EditLocation: TEditLocation; |
39 |
|
|
|
40 |
|
|
implementation |
41 |
|
|
|
42 |
|
|
{$R *.lfm} |
43 |
|
|
|
44 |
|
|
{ TEditLocation } |
45 |
|
|
|
46 |
|
|
procedure TEditLocation.FormShow(Sender: TObject); |
47 |
|
|
begin |
48 |
|
|
Countries.Active := true |
49 |
|
|
end; |
50 |
|
|
|
51 |
|
|
function TEditLocation.ShowModal(Grade: integer; JobCode: string; |
52 |
|
|
var Country: string): TModalResult; |
53 |
|
|
begin |
54 |
|
|
FGrade := Grade; |
55 |
|
|
FCountry := Country; |
56 |
|
|
FJobCode := JobCode; |
57 |
|
|
Result := inherited ShowModal; |
58 |
|
|
if Result = mrOK then |
59 |
|
|
Country := FCountry; |
60 |
|
|
end; |
61 |
|
|
|
62 |
|
|
procedure TEditLocation.FormClose(Sender: TObject; var CloseAction: TCloseAction); |
63 |
|
|
begin |
64 |
|
|
if ModalResult = mrOK then |
65 |
|
|
FCountry := IBLookupComboEditBox2.KeyValue; |
66 |
|
|
Countries.Active := false |
67 |
|
|
end; |
68 |
|
|
|
69 |
|
|
procedure TEditLocation.CountriesBeforeOpen(DataSet: TDataSet); |
70 |
|
|
begin |
71 |
|
|
Countries.ParamByName('JOB_GRADE').AsInteger := FGrade; |
72 |
|
|
Countries.ParamByName('JOB_CODE').AsString := FJobCode |
73 |
|
|
end; |
74 |
|
|
|
75 |
|
|
procedure TEditLocation.CountriesAfterOpen(DataSet: TDataSet); |
76 |
|
|
begin |
77 |
|
|
IBLookupComboEditBox2.KeyValue := FCountry |
78 |
|
|
end; |
79 |
|
|
|
80 |
|
|
end. |
81 |
|
|
|