newObjects Active Label Barcode object

A drawing object (element).

oBarcode = VisiLabel.Element(x);
oBarcode = VisiLabel(x); 

The Barcode object displays an 1-d barcode and optionally a textual representation of the encoded data in it. It supports different fonts, text decorations and can be rotated to 0, 90, 180 and 270 degrees angle. See the remarks section for some additional comments.

Text command:

The text commands are used to represent objects and their settings in the saved label data. When the label is saved or uploaded (see How to Download and Upload) text commands are generated and packed in the specified format (see Misc.SaveFormat). The representation of the entire label with its elements can be also obtained programmatically through VisiLabel.TextCommands and VisiLabel.ObjectParams. The commands have simple syntax and can be generated from the application (just like a HTML output) where appropriate allowing the developer implement different tasks in any suitable way. The label can be instantiated from set of text commands (see the list of the different options to do this). The text commands can be feed into the control programmatically (see VisiLabel.TextCommands) or a download can be invoked (see VisiLabel.Src and VisiLabel.MergeSrc).

A Barcode element object is represented by a BARCODE text command. 


Members reference:

X Sets/Gets the horizontal position of the element's reference point. See the label coordinate space. The property is long integer.
obj.X = value;
v = obj.X;
Y Sets/Gets the vertical position of the element's reference point. See the label coordinate space. The property is long integer.
obj.Y = value;
v = obj.Y;
Color Specifies the foreground color of the element. See Active Label colors.
obj.Color = 0x00FF00; // Sets the color to green
v = obj.Color;
FontFace String. Specifies the face name for the font used in the element.
obj.FontFace = "Arial"; // Specifies font face Arial
vfontface = obj.FontFace;

In WEB applications you should use fonts that are installed on the client machines. Because Active Label is most often used in intranets this is not a problem, but the administrators should make sure all the fonts in use are installed on the workstations.
FontSize Specifies the size of the font used in the element. The size is specified in the current measurement units.
obj.FontSize = 300; // If the default settings are in effect this specifies font size of 3 millimeters
vsize = obj.FontSize;

Note that in contrast with the most applications Active Label uses the same measurement units for all the sizes and locations - including the font size. We believe this is more convenient when the content must be fit on very small sized areas such as sticky labels.
Charset Specifies the font charset to be used. See the remarks below.
obj.Charset = 204; // Sets cyrillic charset
v = obj.Charset;

Active Label is implemented for the ANSI subsystem and not for the UNICODE subsystem. This makes it compatible with all the Windows versions - even Windows 95 without need of additional system updates. Thus when working with fonts that contain characters for multiple alphabets you will need to specify which one to use. Each element may have different charset thus you can display elements in different languages on the same label. See also the CodePage property.
Bold Boolean. Specifies if the font used by the element is bold.
obj.Bold = true; // Make the text bold
vbold = obj.Bold;
Itallic Boolean. Specifies if the font used by the element is itallic.
obj.Itallic = true; // Make the text itallic.
vbold = obj.Itallic;
Underline Boolean. Specifies if the font used by the element is underlined.
obj.Underline = true; // Make the text underlined.
vbold = obj.Underline;
Orientation Long integer. Specifies the orientation in degrees. The angle grows in clockwise direction.
obj.Orientation = 90; Rotate the text 90 degrees clockwise
vdirection = obj.Orientation;
The barcodes can be rotated to 0, 90, 180 and 270 degrees only. In contrast to the text labels it is unacceptable to allow free rotation for barcodes, because the granularity of the printer or the screen will degrade drastically the quality and readability of the barcodes in case of non-orthogonal rotations.
Barcode specific properties
Height Long integer. Height of normal bars in the barcode in the currently selected measurement units (see Misc.Units)
obj.Height = 1200; // Sets the barcode bars height to 12 mm.
v = obj.Height;
Some symbologies are displayed with part of the bars longer than the others - see HeightLong property.
HeightLong Long integer. Height of extended height bars in the barcode in the currently selected measurement units (see Misc.Units)
obj.HeightLong = 1500; // Sets the barcode longer bars height to 15 mm.
v = obj.HeightLong;
Some symbologies are displayed with part of the bars longer than the others - for example EAN13, UPC and so on. Use this property to specify the height of these higher bars for those symbologies.
Wide Long integer. Specifies the width of the wide bars in the barcode.
obj.Wide = 60; // Sets the wide bar width to 0.6 mm
v = obj.Wide;

In version 1.0 only CODE39, CODABAR and Interleaved 2 of 5 (ITF) use this value. The other barcode symbologies use only one the narrow bar width (specified by the Narrow property) and define the wide bars width as 2, 3 or more times narrow bar's width - as required by the corresponding standard. The recommended value for the Wide property is 2 * Narrow. The default value of 60 (0.6 mm) has been chosen to match the capabilities of the most printers. 
Narrow Long integer. Specifies the width of the narrow bars in the barcode.
obj.Narrow = 30; // Sets the wide bar width to 0.3 mm
v = obj.Narrow;

In version 1.0 except CODE39, CODABAR and Interleaved 2 of 5 (ITF) all the barcode symbologies are defined using only narrow bars. The wide bars are defined as 2, 3 or more times the narrow bar width. The default value 30 (0.3 mm) is selected to match the capabilities of the most printers. You can lower it to print smaller barcodes on finer printers (such as laser printers) or specify a bigger value if you intend to use printers with very low resolution (such as matrix printers with 9 pins for instance). If you want to find the smaller readable size for your particular printer we recommend you print several different barcodes and try to scan them. See also DeviceMode for more information for the Active Label printing behavior.
Code Long integer. Specifies the barcode symbology used by the element.
obj.Code = 1; // Specifies Code 39
v = obj.Code;

Version 1.0 of Active Label supports the following sybologies:
0 - Custom barcode (see Value property for details).
1 - CODE39
3 - Interleaved 2 of 5 (also called shortly ITF)
4- CODE93
5 - UPC-A
6 - EAN-13
7 - UPC-E
8 - EAN-8
9 - CODE128 (subset A)
10 - CODE128 (subset B)
11 - CODE128 (subset C)
12 - CODE11
13 - Standard 2 of 5
14 - GTIN14 (in ITF)
15 - GTIN14+5 (in ITF)
16 - UCC/EAN (in Code128 A)
17 - UCC/EAN (in Code 128 B)
18 - UCC/EAN (in Code 128 C)
HumanReadable Long Integer. Specifies if the human readable representation of the barcode will be shown. Value of 0 means "do not show text", while 1 and greater values cause the text to show/. Version 1.0 of Active Label supports only 0 and 1. Where 1 means default text placing. Future versions may add more placement options, you should not use these values in order to avoid incompatibility with future Active Label versions. 
TextSpacing Long integer. Specifies the spacing between the barcode and the human readable text in the current measurement units (see Misc.Units, by default the units are 1/100 of the millimeter).
obj.TextSpacing = 100; // 1 mm offset
voffset = obj.TextSpacing;
Virtually all the fonts have some blank space on top of their characters, thus even 0 text spacing will leave some spacing between the barcode and the text. However when you change the text size (see FontSize property) you may find out that it looks better if placed closer or farther from the barcode. This property gives you the opportunity to adjust this.
StartCharacter String. Specifies the start character for CODABAR. Can be A, B, C or D. It has no effect if any other barcode symbology is selected.
StopCharacter String. Specifies the stop character for CODABAR. Can be A, B, C or D. It has no effect if any other barcode symbology is selected.
AppendChecksumToText Boolean. Specifies if the optional checksum character(s) that are automatically calculated are to be added to the human readable text displayed under the barcode.
obj.AppendChecksumToText = true;
v = obj.AppendChecksumToText;

This property is used together with the AddCheckSum property. When optional checksums are calculated by the barcode element for you - you may want or not want to show them in the human readable text displayed under the barcode. This mostly depends on your application requirements - for instance if you expect the operator to enter the data without the checksums in case of scanner failure you should set this property to false, but if your application requires the full data to be entered in such case - set it to true and the operator will see the data plus the calculated checksums (of course, the operator does not need to know anything about the checksums - he/she will just enter the characters displayed if the scanner equipment fails to read the barcode). Such a need may occur only with barcodes with optional checksums - see the AddCheckSum property for the list of symbologies with optional checksums. The barcode scanners usually support equivalent feature - i.e. they can be configured to include or not include the optional checksum characters with the scanned data.
DeviceMode Boolean. Specifies the drawing mode for the barcode.
obj.DeviceMode = true; // Sets device mode on for the screen.
v = obj.DeviceMode;

This property has effect only on the screen. When printing Active Label always prints in Device Mode. Device Mode means that Active Label will calc the size of the narrow and wide bars/gaps in the barcode in device pixels once (before the drawing of the barcode begins) and will use these widths when it draws each bar/gap. This ensures that the barcode will be virtually always readable even when very thin bars are used. On the screen Active Label can draw in both device mode and normal mode (DeviceMode = false means normal mode). In normal mode each bar/gap is drawn using the current measurement units (see also Misc.Units). In normal mode the barcode width on the screen will match its width on the paper closely, but you will notice easily that on the screen the barcode often looks wrong (because of the rounding of the bar/gaps widths). Therefore having the barcode on the screen drawn in normal mode and printed in Device Mode gives you better setup for a label design tasks, but the screen representation may look corrupted because the monitors have much greater size of their pixels than the printers. As most scanners cannot scan barcodes from screens keeping DeviceMode set to false is ok. You will want to change it to true only if you want the barcodes to be correctly readable directly from the screen. Currently there are too few barcode scanner devices that can do that from screens, but we can expect that this may change in the near future - that is why this property is exposed - to give you the opportunity to show readable barcodes directly on the computer screen.
AlternateValue String. Specifies an alternative text that can be shown as human readable barcode representation.
obj.AlternativeValue = "Some text";
v = obj.AlternativeValue;
In most cases one would want to display as human readable text the data encoded in the barcode - to allow the operator enter it if the barcode scanner fails. However sometimes you may want to display something different instead. Apparently this is the case with the Custom barcodes where only you would know what is encoded. Thus when Code property is set to 0 (custom) the AlternateValue is displayed as human readable text always. When using certain symbology it is not used by default, but you can force the barcode element to display it instead of the Value property by setting the ShowAlternate = true. This is allowed for the most barcodes except for those that by standard should display the encoded data - EAN-13, UPC-A, UPC-E and EAN-8. For example, you can use CODE39, but you may want to display a shorter database ID instead of the encoded data. If your application allows the operator to enter the ID (presuming it is shorter and thus more convenient for manual typing) instead of the encoded data this makes sense and you can use the AlternateValue to set the ID there and ShowAlternate to instruct the element to show it instead of the encoded data.
Other scenarios in which this may come handy are issues with the checksum characters. For example some symbologies allow the application to deal with the checksums. However this is rarely needed because Active Label gives you the most options you may need through the AppendChecksumToText property.
AddCheckSum Long integer. Specifies how many optional checksum characters to append to the encoded data. Differs for each symbology!
obj.Code = 12; // Select CODE11 symbology
obj.AddCheckSum = 2; // Add two checksum characters
Many of the barcode symbologies have a history. Many of them are designed to be self-checking and with the today's scanners even that is rarely important. However in the past the scanners were not so reliable and there was a need of checksums that will guarantee that the code is read correctly. Thus some symbologies have standard checksum characters calculated in a standardized manner. For example CODE93 has two mandatory checksum characters. For it AddCheckSum property has no effect, because the checksums are mandatory, but other symbologies developed in time in different manner and there are applications in which none or only some checksum characters are used. This property allows you configure the barcode element to automatically calc and add them to the encoded data according to the requirements you must meet:
Some information about the symbologies that have optional checksums:
CODE39 has 1. It is rarely used, because the symbology is considered self-checking. Most scanners are by default configured to not expect it. 
Interleaved 2 of 5 (ITF) has 1. It is currently not used anywhere, the barcode scanners support it, but only for compatibility reasons. We recommend to not use it unless you need compatibility with an old application that requires it. The ITF is self-checking - in fact one of the most reliable symbologies and does not actually need a checksum to ensure correct scanning.
CODE11 has 2 optional checksums. It is an old symbology which you should use only if you must obey the requirements of an existing application. Check the application checksum requirements to select the appropriate value - 0, 1 or 2 checksum characters.
Standard 2 of 5 has 1 optional checksum. It is an old symbology too and should not be used unless you are bound by an existing application with which you must preserve compatibility.
Note: CODE11's second checksum and the checksum for Standard 2 of 5 are not officially standardized. Although the checksum calculation for them is a de facto standard there is a slight possibility that you can meet an old application that calculates them in a custom non-standard manner. If that happens select 0 checksum characters and calc the checksum on your own using the algorithm used by the application with which you must keep compatibility. If you need to display the text without the custom checksum you are placing in the data - use the AlternateValue to achieve that.
ShowAlternate Boolean. Specifies which value to show in the human readable text.
obj.ShowAlternate = true; // Show alternate value as human readable representation
vbool = obj.ShowAlternate;
For all the barcode symbologies except custom the data encoded is shown as human readable text if HumanReadable property is non-zero. However in some applications you may want to show different text under the barcode. By using the AlternateValue to specify the text and setting the ShowAlternate to true you instruct the barcode element to do so.
Value String. Specifies the text to be encoded into the barcode
obj.Value = "My Text Label";
vtext = obj.Value;
Note that the different encodings (barcode symbologies) have different specifics - some can encode only numbers, others numbers and some alpha characters and so on. Thus the string specified for this property should match the symbology requirements - if not the barcode element will display with two crossed red lines to indicate the error.
When Code is set to 0 (custom barcode) the value property should contain a pattern string. It consists of the characters listed below and which character instructs the barcode element to show a bar (narrow or wide) or a gap.
Control characters for custom barcodes:
n, s or 0 - Narrow gap.
w or S - Wide gap
N, b or 1 - Narrow bar
l or L - Narrow bar with extended height
W or B - Wide bar

The narrow gaps and bars have the with specified by the Narrow property.
The wide gaps and bars have the width specified by the Wide property
The extended height bars are HeightLong high while other are Height high
The color of the bars is as specified by the Color property.

The custom barcodes are useful if you want to implement barcodes not internally supported by Active Label. See the Code property for the list of the supported barcode symbologies. 

Standard drawing object (element) properties
ElementType Returns an integer constant which describes the element type:
1 - Text Label
2 - Text box
3 - Simple shape
4 - Symbol
5 - Image
6 - Barcode
et = obj.ElementType;
This property is a must when you want to enumerate the elements on the label and perform certain actions on some of them (for example invoke save for the image elements, or check the correctness of the text elements and so on). 
VisiLabel Returns the VisiLabel object on which the element resides.
Index Returns the element's index in the elements stack. 
i = obj.Index;
For example you can use later VisiLabel.Element(i) to obtain the same element.
PropInfo Implements simple type information interface which allows the application to obtain a list of properties supported by the object.

v = obj.PropInfo( nProp [, infoType]);
nProp - >= 0 integer value - the property index for which to obtain infromation. See the remarks.
infoType - What information to return. Currently supported values are:
   0 - the name of the property
   1 - the type of the property as VARTYPE constant.
   2 - the property description.
This is used mostly for internal purposes, but can be useful for some advanced applications as well. The PropInfo can be called with nProp argument ranging from 0 to a certain positive number N. For values greater than N PropInfo returns null. Through it you can obtain a list of the properties supported by the drawing object and some other information about them.
Note that not all the properties you can see in the documentation are described by the PropInfo property. It returns information only for the properties that are best suitable for run-time changes - for example linked to fields in the internal data source. A good example is the Selected property - it is not returned by the PropInfo for any kind of element because it is useful only in interactive mode and makes no sense otherwise.
Name Sets/gets the name of the element
obj.Name = "some name";
v = obj.Name;

It is recommended to keep the element names constant once the label design is complete. For instance when using data to print set of labels, linking the name of an element to a field will change its data linkage once the name is changed. This can be used as a trick, but it will need extreme caution and careful planning.  
Selected Makes the element selected/non-selected in interactive mode.
obj.Selected = value;
issel = obj.Selected;

the property is Boolean.
Makes sense only in interactive editing mode (see Edit object). Most often used by applications/WEB pages that display a list of the elements on the label and allow the user to select an element by clicking its entry in the list. Can be used also for any purpose that requires the application to direct the user's attention to a particular element. 
Locked Changes the locked state of a drawing object (element).
obj.Locked = value;
v = obj.Locked;

the property is Boolean.
This property is used in interactive editing mode (see Edit object). If the VisiLabel.Edit.ProtectLockedElements is set to true then all the locked elements cannot be changed. This allows implementation of visual editing over label design templates where some elements are constant and cannot be changed.
Hidden Changes the visible state of a drawing object (element).
obj.Hidden = value;
v = obj.Hidden;

the property is Boolean. When set to true the element is invisible on the screen and on the printer.
This property is useful in various situations. For example it can be linked to a field in the internal data source to make a particular element visible or invisible depending on the data in the current record.
CodePage Sets/gets the code page as numeric value. The code page is used for all the text translations from UNICODE to ANSI and reverse.
obj.CodePage = value;
cp = obj.CodePage;

By default the system's code page is used. This is usually enough for the most applications, but if you need to place texts in different languages on the label you may need to change the code page of some of the text elements.
Href String. An arbitrary textual value that can be used for a hyperlink if the application that hosts the label desires so.
obj.Href = "../anotherlabel.activelabel"; // points to another label in the parent directory.
vhref = obj.Href;

The Active Label Browser application treats this property as a hyperlink. It is relative to the source location from which the label on which the element resides is loaded. On WEB pages your application may use this property to invoke navigation to another label - i.e. changing the label displayed when the user clicks over certain element on it. However note that on WEB pages all the navigational properties (Src and Dst) are relative to the WEB page's location and not the label load location. See also OnElementClicked event.
Connectivity properties
ObjectState Returns the load state of the object. For the TextLabel element it is always 4 (completed) because barcode elements does not support asynchronous load/save operations.
ShowProperties Displays the property sheets of the element giving the user the opportunity to change the element's settings and visual appearance through them.

In interactive editing mode this can be done also by double clicking over an element or by pressing enter for the selected element.


The barcode elements in Active Label support features corresponding to typical barcode scanner features. This allows you to synchronize the scanner and the printing. For example if your application must use optional checksum characters for symbologies that support such - you can adjust what is printed by using the AddCheckSum and AppendChecksumToText properties without need to alter the data maintained in the application's database. If this is not enough you can do virtually anything else by using AlternateValue and ShowAlternate properties.





newObjects Copyright 2001-2006 newObjects [ ]