- Properties specific to BarCodes variables
- Correspondence between the Content and ContentType properties
- Functions that use BarCodes variables
BarCodes (Type of variable)
In french: CodeBarres
type is used to handle the information found in a bar code. The characteristics of this barcode can be defined and changed using different WLanguage properties.
The BarCodes type can be used as follows:
- The BarCodes type is mainly used to:
- generate bar codes in the pages.
- generate bar codes in the reports.
- print the bar codes (iPrintBarCode).
: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable
MyQRCode is BarCode
MyQRCode.ContentType = bcTypeText
MyQRCode.TypeBarCode = BC_QRCODE
MyQRCode.Content = "http://www.windev.com"
// Assign to a Bar Code control
BAC_BCControl = MyQRCode
// Generate a QRCode with an image
// ------------- Bar code or report initialization code
QRCodeWithImage is BarCode
// Image to be inserted in the center of the barcode
ImageQRCodeCenter is Image
ImageQRCodeCenter = IMG_FLAG
// Type of bar code
QRCodeWithImage.TypeBarCode = BC_QRCODE
QRCodeWithImage.ContentType = bcTypeText
// Image at the center
QRCodeWithImage.Image = ImageQRCodeCenter
// High error correction level to compensate for the image at the center
QRCodeWithImage.CorrectionError = qrcodeLevelH
QRCodeWithImage.ImageProportion = 3
// For an image proportion of 3%, a Level L correction (qrcodeLevelL) would not be enough
// to have a readable bar code
// (Initial) value
QRCodeWithImage.Content = "https://www.windev.com"
// In a report, the value can be reassigned:
//- by binding the control to data
//- in the code before printing
//- in the code for reading data in the report
// or anywhere else afterwards
// Assign to a Bar Code control
BAC_Invoice = QRCodeWithImage
// ------------- Code before printing
BAC_Invoice.Value = "QR code with a flag in the center!"
Properties specific to BarCodes variables
The following properties can be used to handle a bar code:
|Property name||Type used||Effect|
|Content||Any type||Value of bar code. |
- For QR codes, the type of this value depends on the ContentType property .
See the note below to find out the correspondence between the type of content and the type of value.
- When reading bar codes other than QR codes, this property is always of type "String" and its value is the same as that of the RoughValue property.
|ContentType||Integer constant||Nature of data stored in the bar code: |
Remark: These kinds of data are available for the 2D bar codes (QR Code, Aztec, datamatrix, PDF417, ...). For the bar codes other than 2D bar codes, the data is always text data.
- bcTypeText (default value when creating the variable): Plain text
- bcTypePhone: Phone number
- bcTypeSMS: SMS number
- bcTypeEmail: Email address
- bcTypeContact: Contact description
- bcTypeLocation: Geographic position
- bcTypeURL: URL (bookmark). To insert an http address into the bar code, use the cbTypeText type.
This constant is kept for backward compatibility and it must be used in very specific cases.
- bcTypeMarket: Link to an application on Google Play (for an Android application only)
- bcTypeWiFi: Parameters for connecting to a Wi-Fi network (for an Android application only)
|CorrectionError||Integer constant||Correction level of error: used to define the threshold for reading a damaged bar code. |
This property is available for:
- the QR Code bar codes.
- the PDF-417 bar codes.
- the Aztec bar codes.
The following constants are available for the QR Code:
The selected correction level triggers:
- qrcodeLevelH: about 30% of encoded words can be restored.
- qrcodeLevelL: about 7% of encoded words can be restored.
- qrcodeLevelM: about 15% of encoded words can be restored.
- qrcodeLevelQ: about 25% of encoded words can be restored.
- the resizing of bar code.
- the modification of the maximum number of characters allowed in the bar code.
A higher correction level means that the drawing of the bar code will have an important size and that less data will be drawn. On the contrary, a higher correction level means that the bar code will be readable even if the support is damaged.
- If the bar code contains a URL, the level L is sufficient.
- If a logo is inserted into the bar code, we recommend that you use a higher level (M or Q).
- If the bar code is intended for printing labels for a warehouse, the level H must be used.
For the PDF-417 bar codes, the correction level of the error corresponds to an integer included between 0 and 8.
For the Aztec bar codes, the correction level corresponds to an integer included between 5 and 95, representing the percentage of error correction. The default value is 33. If the given value is
- less than 5, the value will be set to 5,
- greater than 95, the value will be set to 95,
- negative, the value will be set to 33 (default value).
|Image||Image added in the center of the bar code (only for QR Codes). The image can correspond to: |
- a variable of type Image,
- a character string containing the path of the image file to be used,
- an image memo item, etc.
|ImageProportion||Real||Percentage of the area occupied by the image added to the center of the barcode (only for QR codes for which the Image property is specified). This value must not exceed half of the area reserved for error correction.|
|Value of the CorrectionError property||Maximum value of the ImageProportion property|
|Options||Integer constant (or combination of constants)||Characteristics of bar code. These characteristics are mainly used when a bar code is printed by iPrintBarCode. The following constants can be used: |
For more details, see The different types of bar codes.
- BC_Bottom: Bar code located at the bottom of destination rectangle.
- BC_ControlDigits: Bar codes containing control characters (valid for the BC_CODE128, BC_DATAMATRIX, BC_EAN128, CB_GS1_128 and BC_PDF417 bar codes). By default, control characters are enclosed between "<" and ">". To avoid interpreting these characters as control characters, simply double the first "<":
- "<C40>" = control character
- "<<AB>" = <AB> to be encoded in the bar code.
- BC_CheckDigits: Bar codes containing check characters (valid for the BC_CODE128, BC_DATAMATRIX, BC_EAN128, CB_GS1_128 and BC_PDF417 bar codes).
If this option is selected, the BC_ControlDigits and BC_Charsets constants are automatically taken into account.
- BC_CenterH: Bar code centered horizontally in the destination rectangle.
- BC_CenterV: Bar code centered vertically in the destination rectangle.
- BC_Right: Bar code aligned to right in the destination rectangle.
- BC_Extended: Extended bar code (valid for the BC_CODE39 and BC_CODE93 bar codes only).
- BC_FormatText: Formats the text displayed for the EAN 128 bar codes: brackets are added around AIs in the printed text.
- BC_Left: Bar code aligned to left in the destination rectangle.
- BC_Top: Bar code located at the top of destination rectangle.
- BC_IgnoreFormatting: Ignores the brackets found in a 128, EAN-128 or GS1-128 bar code (valid for the BC_CODE128, BC_EAN128 and CB_GS1_128 bar codes only).
The brackets allow the users to easily read the bar code but they are not drawn in the code.
- BC_Charsets: Bar code that uses one or more sets of characters in order to compress the bar code. This set of characters must be defined in the value of bar code.
For more details, see The different types of bar codes.
- BC_NotProportional: Adjusts the bar code to the size of destination rectangle.
- BC_NoText: Displays no text below the bar code (valid for the BC_UPCA, BC_UPCB, BC_EAN13 and BC_EAN8 bar codes only).
- BC_Text: Displays the text below the bar code.
The text is normalized for the BC_UPCA, BC_UPCE, BC_EAN13 and BC_EAN8 bar codes.
For the other types of bar codes, the text can exceed the display border of bar code.
New in version 28BC_TextCenter
: Centers the text below the bar code (valid only for BC_CODE128
New in version 28BC_TextRight
: Aligns the text below the bar code to the right (valid only for BC_CODE128
New in version 28BC_TextLeft
: Aligns the text below the bar code to the left (valid only for BC_CODE128
- BC_Check: Bar code with check characters (valid for the BC_CODE39, BC_CODE93, BC_INTER2OF5 and BC_CODABAR bar codes only).
- BC_Vertical: Prints the bar code vertically.
- BC_90: Prints the bar code vertically.
- BC_180: Prints the bar code while performing a rotation equal to 180 degrees.
- BC_270: Prints the bar code while performing a rotation equal to 270 degrees.
|RoughValue||Unicode string||Rough value of bar code. |
For barcodes other than QR codes, the value of this property is the same as that of the Content property.
This property is read-only.
|TypeBarCode||Integer constant||Bar code type: |
- BC_AZTEC: AZTEC bar code.
- BC_MAXICODE: MaxiCode bar code.
- BC_QRCODE: QR Code. This constant is used by default when creating a BarCode variable.
- BC_UPCA: UPC-A bar code.
- BC_UPCE: UPC-E bar code.
- BC_EAN8: EAN8 bar code.
- BC_EAN13: EAN13 bar code.
- BC_CODE39: Code39 bar code.
- BC_CODE93: Code93 bar code.
- BC_CODE128: Code128 bar code.
- CB_GS1_128: GS1-128 bar code (new name for the EAN128 bar code).
- BC_INTER2OF5: Interleaved 2 of 5 bar code.
- BC_DATAMATRIX: DATAMATRIX bar code.
- BC_PDF417: PDF417 bar code.
- BC_CODABAR: Codabar bar code.
- BC_CODE11: Code11 bar code.
- BC_EAN128: EAN128 bar code.
- BC_MSI: MSI bar code.
These types are also available for the prints performed by iPrintBarCode
Correspondence between the Content and ContentType properties
|Type of content||Type of value (Content property)||Remark|
|bcTypeText||Character string||Example: "WINDEV is great!"|
|bcTypePhone||Character string||Example: "0612345678"|
In read mode: The members of the SMS structure (SMS.Message and SMS.Number) will be automatically filled with the values read in the bar code. the content will correspond to a string in the following format: <Number> + CR + <Message>
In generation: If they exist, the members of the SMS structure
(SMS.Message and SMS.Number) will be automatically taken into account. You also have the ability to use a character string in the following format: <Number> + CR + <Message>
|Example: "0612345678<CR>Text to send"|
Corresponds to a bookmark. The content will be encoded in the following format: "urlto::URL". For example: "urlto::http://www.windev.com". Some decoders do not support this type of content.
To specify an http address, use the cbTypeText type.
Remark: This constant is kept for backward compatibility and it must be used in very specific cases.
|bcTypeMarket||Character string||Example: "market://search?q=pname:com.company.application"|
|bcTypeWiFi||Character string||Character string in the following format: |
<SSID> + TAB + <Security protocol>+ TAB + <Key>
|bcTypeEmail||Character string||Example: "firstname.lastname@example.org"|
In read mode: The members of the mContact structure will be automatically filled with the values read in the bar code.
In generation: The members of the mContact structure will automatically be used to generate the bar code.
In read mode: The Latitude and Longitude properties of the variable will be automatically filled with the values read in the barcode.
In generation: The Latitude and Longitude properties of the variable will be automatically used to generate the barcode.
Functions that use BarCodes variables
|BCCapture||Decodes the information stored in a bar code by using the device camera (Android, iPhone, iPad).|
|BCDecode||Decodes the information stored in a QR Code bar code.|
|iPrintBarCode||Prints a bar code (inside a rectangle).|Remark
: You can use VariableReset
to reset the content of a BarCode
Android (WINDEV Mobile): Android Inventory
This page is also available for…