ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/dbcontrolgrid/unit5.pas
Revision: 143
Committed: Fri Feb 23 12:11:21 2018 UTC (6 years, 8 months ago) by tony
Content type: text/x-pascal
File size: 2666 byte(s)
Log Message:
Fixes Merged

File Contents

# User Rev Content
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 23 unit Unit5;
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     { TEditJobCode }
40    
41     TEditJobCode = class(TForm)
42     Bevel1: TBevel;
43     Button1: TButton;
44     Button2: TButton;
45     IBLookupComboEditBox1: TIBLookupComboEditBox;
46     JobCodes: TIBQuery;
47     JobCodeSource: TDataSource;
48     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
49     procedure FormShow(Sender: TObject);
50     procedure JobCodesAfterOpen(DataSet: TDataSet);
51     procedure JobCodesBeforeOpen(DataSet: TDataSet);
52     private
53     { private declarations }
54     FGrade: integer;
55     FCountry: string;
56     FJobCode: string;
57     public
58     { public declarations }
59     function ShowModal(Grade: integer; Country: string; var JobCode:string): TModalResult;
60     end;
61    
62     var
63     EditJobCode: TEditJobCode;
64    
65     implementation
66    
67     {$R *.lfm}
68    
69     { TEditJobCode }
70    
71     procedure TEditJobCode.FormShow(Sender: TObject);
72     begin
73     JobCodes.Active := true;
74     end;
75    
76     procedure TEditJobCode.JobCodesAfterOpen(DataSet: TDataSet);
77     begin
78     IBLookupComboEditBox1.KeyValue := FJobCode;
79     end;
80    
81     procedure TEditJobCode.JobCodesBeforeOpen(DataSet: TDataSet);
82     begin
83     JobCodes.ParamByName('JOB_GRADE').AsInteger := FGrade;
84     JobCodes.ParamByName('JOB_COUNTRY').AsString := FCountry;
85     end;
86    
87     function TEditJobCode.ShowModal(Grade: integer; Country: string; var JobCode: string
88     ): TModalResult;
89     begin
90     FGrade := Grade;
91     FCountry := Country;
92     FJobCode := JobCode;
93     Result := inherited ShowModal;
94     if Result = mrOK then
95     JobCode := FJobCode;
96     end;
97    
98     procedure TEditJobCode.FormClose(Sender: TObject; var CloseAction: TCloseAction);
99     begin
100     if ModalResult = mrOK then
101     FJobCode := IBLookupComboEditBox1.KeyValue;
102     JobCodes.Active := false
103     end;
104    
105     end.
106