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

Annotation of /dao/DelphiScanner/Components/tpsystools_4.04/source/StDbBarC.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (hide annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 10 months ago) by torben
File size: 3043 byte(s)
Added tpsystools component
1 torben 2671 (* ***** 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: StDbBarC.pas 4.04 *}
28     {*********************************************************}
29     {* SysTools: data aware bar code components *}
30     {*********************************************************}
31    
32     {$I StDefine.inc}
33    
34     unit StDbBarC;
35    
36     interface
37    
38     uses
39     Windows, Classes, ClipBrd, Controls, Graphics, Messages, SysUtils,
40     Db, DbCtrls, DbTables,
41     StConst, StBarc;
42    
43     type
44     TStDbBarCode = class(TStBarCode)
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 Code
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    
78     {*** TStDbBarCode ***}
79    
80     constructor TStDbBarCode.Create(AOwner : TComponent);
81     begin
82     inherited Create(AOwner);
83    
84     FDataLink := TFieldDataLink.Create;
85     FDataLink.OnDataChange := DataChange;
86     end;
87    
88     procedure TStDbBarCode.DataChange(Sender : TObject);
89     begin
90     if FDataLink.Field = nil then
91     Code := '12345678922'
92     else
93     Code := FDataLink.Field.DisplayText;
94     end;
95    
96     destructor TStDbBarCode.Destroy;
97     begin
98     FDataLink.OnDataChange := nil;
99     FDataLink.Free;
100     FDataLink := nil;
101    
102     inherited Destroy;
103     end;
104    
105     function TStDbBarCode.GetDataField : string;
106     begin
107     Result := FDataLink.FieldName;
108     end;
109    
110     function TStDbBarCode.GetDataSource : TDataSource;
111     begin
112     Result := FDataLink.DataSource
113     end;
114    
115     procedure TStDbBarCode.SetDataField(const Value : string);
116     begin
117     FDataLink.FieldName := Value;
118     end;
119    
120     procedure TStDbBarCode.SetDataSource(Value : TDataSource);
121     begin
122     FDataLink.DataSource := Value;
123     end;
124    
125    
126     end.

  ViewVC Help
Powered by ViewVC 1.1.20