/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/examples/CBuilder/ExBarCU.cpp
ViewVC logotype

Annotation of /dao/DelphiScanner/Components/tpsystools_4.04/examples/CBuilder/ExBarCU.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (hide annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 12268 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     #include <vcl\vcl.h>
27     #pragma hdrstop
28    
29     #include "ExBarCU.h"
30     //---------------------------------------------------------------------------
31     #pragma package(smart_init)
32     #pragma link "StDbBarC"
33     #pragma link "StBarC"
34     #pragma link "Grids"
35     #pragma link "Printers"
36     #pragma link "StBarC"
37     #pragma link "Controls"
38    
39     #pragma link "St2DBarC"
40     #pragma resource "*.dfm"
41     TForm1 *Form1;
42     //---------------------------------------------------------------------------
43     __fastcall TForm1::TForm1(TComponent* Owner)
44     : TForm(Owner)
45     {
46     }
47     //---------------------------------------------------------------------------
48     void __fastcall TForm1::btnPrintClick(TObject *Sender)
49     {
50     if (!PrintDialog1->Execute())
51     return;
52     Application->ProcessMessages();
53    
54     Screen->Cursor = crHourGlass;
55     Printer()->BeginDoc();
56     Printer()->Title = "StBarCode";
57    
58     BarCode1->BarCodeType = bcUPC_A;
59     BarCode1->Code = "52100014015";
60     BarCode1->SupplementalCode = "";
61     BarCode1->PaintToCanvasSize(Printer()->Canvas, 0.5, 0.5, 0.5);
62     BarCode1->SupplementalCode = "12";
63     BarCode1->PaintToCanvasSize(Printer()->Canvas, 3.0, 0.5, 0.5);
64     BarCode1->SupplementalCode = "12345";
65     BarCode1->PaintToCanvasSize(Printer()->Canvas, 6.0, 0.5, 0.5);
66    
67     BarCode1->BarCodeType =bcUPC_E;
68     BarCode1->Code = "173559";
69     BarCode1->SupplementalCode = "";
70     BarCode1->PaintToCanvasSize(Printer()->Canvas, 0.5, 1.5, 0.5);
71     BarCode1->SupplementalCode = "12";
72     BarCode1->PaintToCanvasSize(Printer()->Canvas, 3.0, 1.5, 0.5);
73     BarCode1->SupplementalCode = "12345";
74     BarCode1->PaintToCanvasSize(Printer()->Canvas, 6.0, 1.5, 0.5);
75    
76     BarCode1->BarCodeType = bcEAN_13;
77     BarCode1->Code = "737622135746";
78     BarCode1->SupplementalCode = "";
79     BarCode1->PaintToCanvasSize(Printer()->Canvas, 0.5, 2.5, 0.5);
80     BarCode1->SupplementalCode = "12";
81     BarCode1->PaintToCanvasSize(Printer()->Canvas, 3.0, 2.5, 0.5);
82     BarCode1->SupplementalCode = "12345";
83     BarCode1->PaintToCanvasSize(Printer()->Canvas, 6.0, 2.5, 0.5);
84    
85     BarCode1->BarCodeType = bcEAN_8;
86     BarCode1->Code = "1234567";
87     BarCode1->SupplementalCode = "";
88     BarCode1->PaintToCanvasSize(Printer()->Canvas, 0.5, 3.5, 0.5);
89     BarCode1->SupplementalCode = "12";
90     BarCode1->PaintToCanvasSize(Printer()->Canvas, 3.0, 3.5, 0.5);
91     BarCode1->SupplementalCode = "12345";
92     BarCode1->PaintToCanvasSize(Printer()->Canvas, 6.0, 3.5, 0.5);
93    
94     BarCode2->BarCodeType = bcInterleaved2of5;
95     BarCode2->Code = "0123456789";
96     BarCode2->PaintToCanvasSize(Printer()->Canvas, 0.5, 4.5, 0.5);
97    
98     BarCode3->BarCodeType = bcCodabar;
99     BarCode3->Code = "c1234567890d";
100     BarCode3->PaintToCanvasSize(Printer()->Canvas, 3.0, 4.5, 0.5);
101    
102     BarCode4->BarCodeType = bcCode11;
103     BarCode4->Code = "0123456-12";
104     BarCode4->PaintToCanvasSize(Printer()->Canvas, 5.0, 4.5, 0.5);
105    
106     BarCode5->BarCodeType = bcCode39;
107     BarCode5->Code = "1234567890ABCDEFG";
108     BarCode5->PaintToCanvasSize(Printer()->Canvas, 0.5, 5.5, 0.5);
109     BarCode5->Code = "4-976 SUGARLOAF HWY";
110     BarCode5->PaintToCanvasSize(Printer()->Canvas, 4.5, 5.5, 0.5);
111    
112     BarCode6->BarCodeType = bcCode93;
113     BarCode6->Code = "CODE 93";
114     BarCode6->PaintToCanvasSize(Printer()->Canvas, 0.5, 6.5, 0.5);
115    
116     BarCode7->BarCodeType = bcCode128;
117     BarCode7->Code128Subset = csCodeA;
118     BarCode7->Code = "CODE 128";
119     BarCode7->Validate(true);
120     BarCode7->PaintToCanvasSize(Printer()->Canvas, 3.0, 6.5, 0.5);
121    
122     StMaxiCodeBarcode1->Mode = cmMode5;
123     StMaxiCodeBarcode1->Code = "MaxiCode";
124     StMaxiCodeBarcode1->Caption = "MaxiCode";
125     StMaxiCodeBarcode1->PaintToPrinterCanvasSize (Printer()->Canvas, 0.5, 7.5, 1);
126    
127     StPDF417Barcode1->Code = "PDF417";
128     StPDF417Barcode1->Caption = "PDF417";
129     StPDF417Barcode1->PaintToPrinterCanvasSize (Printer()->Canvas, 3.0, 7.5, 1);
130    
131     if (!Printer()->Aborted)
132     Printer()->EndDoc();
133     Screen->Cursor = crDefault;
134     }
135     //---------------------------------------------------------------------------
136     void __fastcall TForm1::btnValidateClick(TObject *Sender)
137     {
138     switch (NB->PageIndex) {
139     case 0 : {BarCode1->Validate(true); break;};
140     case 1 : {BarCode2->Validate(true); break;};
141     case 2 : {BarCode3->Validate(true); break;};
142     case 3 : {BarCode4->Validate(true); break;};
143     case 4 : {BarCode5->Validate(true); break;};
144     case 5 : {BarCode6->Validate(true); break;};
145     case 6 : {BarCode7->Validate(true); break;};
146     };
147     }
148     //---------------------------------------------------------------------------
149     void __fastcall TForm1::btnSaveClick(TObject *Sender)
150     {
151     switch (NB->PageIndex) {
152     case 0 : {BarCode1->SaveToFile("UPCEAN.bmp"); break;};
153     case 1 : {BarCode2->SaveToFile("I2of5.bmp"); break;};
154     case 2 : {BarCode3->SaveToFile("Codabar.bmp"); break;};
155     case 3 : {BarCode4->SaveToFile("Code11.bmp"); break;};
156     case 4 : {BarCode5->SaveToFile("Code39.bmp"); break;};
157     case 5 : {BarCode6->SaveToFile("Code93.bmp"); break;};
158     case 6 : {BarCode7->SaveToFile("Code128.bmp"); break;};
159     case 7 : {StPDF417Barcode1->SaveToFile ("PDF417.bmp"); break;}
160     case 8 : {StMaxiCodeBarcode1->SaveToFile ("MaxiCode.bmp"); break;}
161     };
162     }
163     //---------------------------------------------------------------------------
164     void __fastcall TForm1::btnCopyClick(TObject *Sender)
165     {
166     switch (NB->PageIndex) {
167     case 0 : {BarCode1->CopyToClipboard(); break;};
168     case 1 : {BarCode2->CopyToClipboard(); break;};
169     case 2 : {BarCode3->CopyToClipboard(); break;};
170     case 3 : {BarCode4->CopyToClipboard(); break;};
171     case 4 : {BarCode5->CopyToClipboard(); break;};
172     case 5 : {BarCode6->CopyToClipboard(); break;};
173     case 6 : {BarCode7->CopyToClipboard(); break;};
174     case 7 : {StPDF417Barcode1->CopyToClipboard(); break;};
175     case 8 : {StMaxiCodeBarcode1->CopyToClipboard(); break;};
176     };
177     }
178     //---------------------------------------------------------------------------
179     void __fastcall TForm1::btnCloseClick(TObject *Sender)
180     {
181     Close();
182     }
183     //---------------------------------------------------------------------------
184     void __fastcall TForm1::btnUpdate1Click(TObject *Sender)
185     {
186     switch (rgType->ItemIndex) {
187     case 0 : {
188     BarCode1->BarCodeType = bcUPC_A;
189     edCode1->MaxLength = 12;
190     if (edCode1->Text.Length() > 12)
191     edCode1->Text.SetLength(12);
192     Label1->Caption = "Code: 11 or 12 Numeric ";
193     break;
194     };
195     case 1 : {
196     BarCode1->BarCodeType = bcUPC_E;
197     edCode1->MaxLength = 6;
198     Label1->Caption = "Code: 6 Numeric ";
199     if (edCode1->Text.Length() > 6)
200     edCode1->Text.SetLength(6);
201     break;
202     };
203     case 2 : {
204     BarCode1->BarCodeType = bcEAN_13;
205     edCode1->MaxLength = 13;
206     Label1->Caption = "Code: 12 or 13 Numeric ";
207     if (edCode1->Text.Length() > 13)
208     edCode1->Text.SetLength(13);
209     break;
210     };
211     case 3 : {
212     BarCode1->BarCodeType = bcEAN_8;
213     edCode1->MaxLength = 8;
214     Label1->Caption = "Code: 7 or 8 Numeric ";
215     if (edCode1->Text.Length() > 8)
216     edCode1->Text.SetLength(8);
217     break;
218     };
219     };
220    
221     BarCode1->ShowCode = cbShowCode->Checked;
222     BarCode1->TallGuardBars = cbTallGuardBars->Checked;
223     BarCode1->Code = edCode1->Text;
224     if (cbSupp->Checked) {
225     BarCode1->SupplementalCode = edSupp->Text;
226     edSupp->Enabled = true;
227     } else {
228     BarCode1->SupplementalCode = "";
229     edSupp->Enabled = false;
230     };
231     }
232     //---------------------------------------------------------------------------
233     void __fastcall TForm1::btnUpdate2Click(TObject *Sender)
234     {
235     BarCode2->Code = edCode2->Text;
236     BarCode2->ShowCode = cbShowCode2->Checked;
237     BarCode2->BearerBars = cbBearerBars->Checked;
238     }
239     //---------------------------------------------------------------------------
240     void __fastcall TForm1::btnUpdate3Click(TObject *Sender)
241     {
242     BarCode3->Code = edCode3->Text;
243     BarCode3->ShowCode = cbShowCode3->Checked;
244     BarCode3->ShowGuardChars = cbShowGuardChars3->Checked;
245     }
246     //---------------------------------------------------------------------------
247     void __fastcall TForm1::btnUpdate4Click(TObject *Sender)
248     {
249     BarCode4->Code = edCode4->Text;
250     BarCode4->ShowCode = cbShowCode4->Checked;
251     }
252     //---------------------------------------------------------------------------
253     void __fastcall TForm1::btnUpdate5Click(TObject *Sender)
254     {
255     BarCode5->Code = edCode5->Text;
256     BarCode5->ShowCode = cbShowCode5->Checked;
257     }
258     //---------------------------------------------------------------------------
259     void __fastcall TForm1::btnUpdate6Click(TObject *Sender)
260     {
261     BarCode6->Code = edCode6->Text;
262     BarCode6->ShowCode = cbShowCode6->Checked;
263     }
264     //---------------------------------------------------------------------------
265     void __fastcall TForm1::btnUpdate7Click(TObject *Sender)
266     {
267     BarCode7->Code = edCode7->Text;
268     BarCode7->ShowCode = cbShowCode7->Checked;
269     }
270     //---------------------------------------------------------------------------
271     void __fastcall TForm1::edCodePDF417Exit(TObject *Sender)
272     {
273     StPDF417Barcode1->Truncated = cbPDF417Truncated->Checked;
274     StPDF417Barcode1->Code = edCodePDF417->Text;
275     if (cbShowCodePDF417->Checked)
276     StPDF417Barcode1->Caption = edCodePDF417->Text;
277     else
278     StPDF417Barcode1->Caption = "";
279     }
280     //---------------------------------------------------------------------------
281     void __fastcall TForm1::btnUpdateMaxiCodeClick(TObject *Sender)
282     {
283     StMaxiCodeBarcode1->Code = edCodeMaxiCode->Text;
284     StMaxiCodeBarcode1->CarrierCountryCode = StrToInt (edMCCountryCode->Text);
285     StMaxiCodeBarcode1->CarrierPostalCode = edMCPostalCode->Text;
286     StMaxiCodeBarcode1->CarrierServiceClass = StrToInt (edMCServiceClass->Text);
287     if (cbShowCodeMaxiCode->Checked)
288     StMaxiCodeBarcode1->Caption = edCodeMaxiCode->Text;
289     else
290     StMaxiCodeBarcode1->Caption = "";
291     }
292     //---------------------------------------------------------------------------
293     void __fastcall TForm1::radMCMode23Click(TObject *Sender)
294     {
295     edMCServiceClass->Enabled = true;
296     edMCPostalCode->Enabled = true;
297     edMCCountryCode->Enabled = true;
298     StMaxiCodeBarcode1->Mode = cmMode2;
299     btnUpdateMaxiCodeClick (Sender);
300     }
301     //---------------------------------------------------------------------------
302     void __fastcall TForm1::radMCMode4Click(TObject *Sender)
303     {
304     edMCServiceClass->Enabled = false;
305     edMCPostalCode->Enabled = false;
306     edMCCountryCode->Enabled = false;
307     StMaxiCodeBarcode1->Mode = cmMode4;
308     btnUpdateMaxiCodeClick (Sender);
309     }
310     //---------------------------------------------------------------------------
311     void __fastcall TForm1::radMCMode5Click(TObject *Sender)
312     {
313     edMCServiceClass->Enabled = false;
314     edMCPostalCode->Enabled = false;
315     edMCCountryCode->Enabled = false;
316     StMaxiCodeBarcode1->Mode = cmMode5;
317     btnUpdateMaxiCodeClick (Sender);
318     }
319     //---------------------------------------------------------------------------
320     void __fastcall TForm1::NBChange(TObject *Sender, int NewTab,
321     bool &AllowChange)
322     {
323     if (NewTab == 7 || NewTab == 8)
324     btnValidate->Enabled = false;
325     else
326     btnValidate->Enabled = true;
327     }
328     //---------------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.20