PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of BarCodes variables
  • Correspondence between the Content and ContentType properties
  • Functions that use the BarCodes variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The BarCodes type is used to handle the information found in a bar code. The characteristics of this barcode can be defined and modified using different WLanguage properties.
The BarCodes type can be used as follows:
    Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
    Example
    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
    Versions 24 and later
    // 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
    QRCodeWithImage.ImageProportion = 3
    // High error correction level to compensate for the image at the center
    QRCodeWithImage.CorrectionError = qrcodeLevelH
    // 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!"
    New in version 24
    // 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
    QRCodeWithImage.ImageProportion = 3
    // High error correction level to compensate for the image at the center
    QRCodeWithImage.CorrectionError = qrcodeLevelH
    // 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!"
    // 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
    QRCodeWithImage.ImageProportion = 3
    // High error correction level to compensate for the image at the center
    QRCodeWithImage.CorrectionError = qrcodeLevelH
    // 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!"
    Remarks

    Properties specific to the description of BarCodes variables

    The following properties can be used to handle a bar code:
    Property nameType usedEffect
    ContentAny typeValue of bar code.
    • For QR codes, the type of this value depends on the ContentTypeproperty .
      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.
    CorrectionErrorInteger constantCorrection 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.
    • Versions 21 and later
      the Aztec bar codes.
      New in version 21
      the Aztec bar codes.
      the Aztec bar codes.
    The following constants are available for the QR Code:
    • 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 selected correction level triggers:
    • 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.
    Tips:
    • 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.
    Versions 21 and later
    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).
    New in version 21
    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).
    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).
    Versions 24 and later
    Image
    New in version 24
    Image
    Image
    Image added in the center of the bar code (only for QR Codes). This image can correspond to:
    • an Image variable,
    • a character string containing the path of the image file to be used,
    • an image memo item, etc.
    OptionsInteger 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:
    • 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, the control characters are enclosed between the "<" and ">" characters. In order for these characters not to be interpreted as control characters, they must be doubled.
      See The different types of bar codes for more details.
    • 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).
    • Versions 18 and later
      BC_FormatText: Formats the text displayed for the EAN 128 bar codes: brackets are added around AIs in the printed text.
      New in version 18
      BC_FormatText: Formats the text displayed for the EAN 128 bar codes: brackets are added around AIs in the printed text.
      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.
      See The different types of bar codes for more details.
    • BC_NotProportional: Adjusts the bar code to the size of destination rectangle.
    • BC_NoText: 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.
    • 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.
    Versions 24 and later
    ImageProportion
    New in version 24
    ImageProportion
    ImageProportion
    RealPercentage 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 propertyMaximum value of the ImageProportion property
    qrcodeLevelH5
    qrcodeLevelL1
    qrcodeLevelM3
    qrcodeLevelQ 5

    TypeBarCodeInteger constantBar code type:
    • Versions 21 and later
      BC_AZTEC: AZTEC bar code.
      New in version 21
      BC_AZTEC: AZTEC bar code.
      BC_AZTEC: AZTEC bar code.
    • Versions 21 and later
      BC_MAXICODE: MaxiCode bar code.
      New in version 21
      BC_MAXICODE: MaxiCode bar code.
      BC_MAXICODE: MaxiCode bar code.
    • BC_QRCODE: QR Code bar 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.
    • Versions 18 and later
      CB_GS1_128: GS1-128 bar code (new name for the EAN128 bar code).
      New in version 18
      CB_GS1_128: GS1-128 bar code (new name for the EAN128 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.
    ContentTypeInteger constantNature of data stored in the bar code:
    • 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)
    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.
    RoughValueUnicode stringRough 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 available in read-only.

    Correspondence between the Content and ContentType properties

    Type of contentType of value (Content property)Remark
    bcTypeTextCharacter stringExample: "WINDEV is great!"
    bcTypePhoneCharacter stringExample: "0612345678"
    bcTypeSMSCharacter string
    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"
    bcTypeURLCharacter string
    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.
    Example: "http://www.google.com"
    bcTypeMarketCharacter stringExample: "market://search?q=pname:com.company.application"
    bcTypeWiFiCharacter stringCharacter string in the following format:
    <SSID> + TAB + <Security protocol>+ TAB + <Key>
    Example: "MyNetwork<TAB>WPA<TAB>pwd"
    bcTypeEmailCharacter stringExample: "name@email.com"
    bcTypeContactEmpty.
    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.
    bcTypeLocationgeoPosition variable.
    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 the BarCodes variables

    Versions 16 and later
    BCCapture
    New in version 16
    BCCapture
    BCCapture
    Decodes the information stored in a bar code by using the device camera (Android, iPhone, iPad).
    Versions 16 and later
    BCDecode
    New in version 16
    BCDecode
    BCDecode
    Decodes the information stored in a QR Code bar code.
    Versions 09 and later
    iPrintBarCode
    New in version 09
    iPrintBarCode
    iPrintBarCode
    Prints a bar code (inside a rectangle).
    Remark: You can use VariableReset to reinitialize the content of a BarCode variable.
    Related Examples:
    Android Inventory Android (WINDEV Mobile): Android Inventory
    [ + ] This application is used to perform inventories and to save the results in a database.
    Minimum version required
    • Version 16
    This page is also available for…
    Comments
    Video CodeBarra
    https://youtu.be/ATKmFo_fB-k
    https://windevdesenvolvimento.blogspot.com/2019/08/dicas-2252-windev-webdev-mobile-24.html
    // btn gera imagen qrcode
    MEU_qrcode is BarCodes
    MEU_qrcode..Content=EDT_CONTEUDO
    MEU_qrcode..TypeBarCode=BC_QRCODE
    MEU_qrcode..CorrectionError=qrcodeLevelM
    MEU_qrcode..ContentType = bcTypeText
    MEU_qrcode..Image="C:\temp\PRAIA\i2\2019-07-14_1200.png"
    MEU_qrcode..ImageProportion=3
    BAC_QRCODE=MEU_qrcode
    amarildo
    16 Aug. 2019