/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/source/StDbPNBC.pas
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/source/StDbPNBC.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 10 months ago) by torben
File size: 3074 byte(s)
Added tpsystools component
1 (* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is TurboPower SysTools
15 *
16 * The Initial Developer of the Original Code is
17 * TurboPower Software
18 *
19 * Portions created by the Initial Developer are Copyright (C) 1996-2002
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * ***** END LICENSE BLOCK ***** *)
25
26 {*********************************************************}
27 {* SysTools: StDbPNBC.pas 4.04 *}
28 {*********************************************************}
29 {* SysTools: data aware PostNet Bar Code component *}
30 {*********************************************************}
31
32 {$I STDEFINE.INC}
33
34 unit StDbPNBC;
35
36 interface
37
38 uses
39 Windows, Classes, ClipBrd, Controls, Graphics, Messages, SysUtils,
40 Db, DbCtrls, DbTables,
41 StConst, StBarPN;
42
43 type
44 TStDbPNBarCode = class(TStPNBarCode)
45 protected {private}
46 {.Z+}
47 FDataLink : TFieldDataLink;
48
49 procedure DataChange(Sender : TObject);
50 function GetDataField : string;
51 function GetDataSource : TDataSource;
52 procedure SetDataField(const Value : string);
53 procedure SetDataSource(Value : TDataSource);
54
55 public
56 constructor Create(AOwner : TComponent);
57 override;
58 destructor Destroy;
59 override;
60 {.Z+}
61 published
62 property PostalCode
63 stored False;
64
65 property DataField : string
66 read GetDataField
67 write SetDataField;
68
69 property DataSource : TDataSource
70 read GetDataSource
71 write SetDataSource;
72 end;
73
74
75 implementation
76
77 {*** TStDbPNBarCode ***}
78
79 constructor TStDbPNBarCode.Create(AOwner : TComponent);
80 begin
81 inherited Create(AOwner);
82
83 FDataLink := TFieldDataLink.Create;
84 FDataLink.OnDataChange := DataChange;
85 end;
86
87 procedure TStDbPNBarCode.DataChange(Sender : TObject);
88 begin
89 if FDataLink.Field = nil then
90 PostalCode := '12345'
91 else
92 PostalCode := FDataLink.Field.DisplayText;
93 end;
94
95 destructor TStDbPNBarCode.Destroy;
96 begin
97 FDataLink.OnDataChange := nil;
98 FDataLink.Free;
99 FDataLink := nil;
100
101 inherited Destroy;
102 end;
103
104 function TStDbPNBarCode.GetDataField : string;
105 begin
106 Result := FDataLink.FieldName;
107 end;
108
109 function TStDbPNBarCode.GetDataSource : TDataSource;
110 begin
111 Result := FDataLink.DataSource
112 end;
113
114 procedure TStDbPNBarCode.SetDataField(const Value : string);
115 begin
116 FDataLink.FieldName := Value;
117 end;
118
119 procedure TStDbPNBarCode.SetDataSource(Value : TDataSource);
120 begin
121 FDataLink.DataSource := Value;
122 end;
123
124
125 end.

  ViewVC Help
Powered by ViewVC 1.1.20