ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/examples/dbcontrolgrid/unit4.pas
Revision: 362
Committed: Tue Dec 7 13:27:39 2021 UTC (3 years ago) by tony
Content type: text/x-pascal
File size: 2685 byte(s)
Log Message:
initiate test release

File Contents

# Content
1 (*
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 unit Unit4;
28
29 {$mode objfpc}{$H+}
30
31 interface
32
33 uses
34 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
35 StdCtrls, db, IBQuery, IBLookupComboEditBox;
36
37 type
38
39 { TEditLocation }
40
41 TEditLocation = class(TForm)
42 Bevel1: TBevel;
43 Button1: TButton;
44 Button2: TButton;
45 Countries: TIBQuery;
46 CountrySource: TDataSource;
47 IBLookupComboEditBox2: TIBLookupComboEditBox;
48 procedure CountriesAfterOpen(DataSet: TDataSet);
49 procedure CountriesBeforeOpen(DataSet: TDataSet);
50 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
51 procedure FormShow(Sender: TObject);
52 private
53 { private declarations }
54 FGrade: integer;
55 FCountry: string;
56 FJobCode: string;
57 public
58 { public declarations }
59 function ShowModal(Grade: integer; JobCode: string; var Country: string
60 ): TModalResult;
61 end;
62
63 var
64 EditLocation: TEditLocation;
65
66 implementation
67
68 {$R *.lfm}
69
70 { TEditLocation }
71
72 procedure TEditLocation.FormShow(Sender: TObject);
73 begin
74 Countries.Active := true
75 end;
76
77 function TEditLocation.ShowModal(Grade: integer; JobCode: string;
78 var Country: string): TModalResult;
79 begin
80 FGrade := Grade;
81 FCountry := Country;
82 FJobCode := JobCode;
83 Result := inherited ShowModal;
84 if Result = mrOK then
85 Country := FCountry;
86 end;
87
88 procedure TEditLocation.FormClose(Sender: TObject; var CloseAction: TCloseAction);
89 begin
90 if ModalResult = mrOK then
91 FCountry := IBLookupComboEditBox2.KeyValue;
92 Countries.Active := false
93 end;
94
95 procedure TEditLocation.CountriesBeforeOpen(DataSet: TDataSet);
96 begin
97 Countries.ParamByName('JOB_GRADE').AsInteger := FGrade;
98 Countries.ParamByName('JOB_CODE').AsString := FJobCode
99 end;
100
101 procedure TEditLocation.CountriesAfterOpen(DataSet: TDataSet);
102 begin
103 IBLookupComboEditBox2.KeyValue := FCountry
104 end;
105
106 end.
107