QRCode

From NSB App Studio
Jump to navigation Jump to search

Description

The QRCode control is used to display a QR Code. QR Codes are widely used to make scannable web links, but have other uses as well.

To add an image to your app, choose the QRCode icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the button: usually, just onclick.

The options argument on setValue is optional. Properties of it are:

Options
name value
modules Bitmatrix class with modules data
version Calculated QR Code version. 1-40. Suitable value will be calculated.
errorCorrectionLevel Error Correction Level. "L", "M", "Q", "H".
maskPattern Calculated Mask pattern. Possible values are 0, 1, 2, 3, 4, 5, 6, 7.
segments Generated segments. See detailed docs.
toSJISFunc Helper function used internally to convert a kanji to its Shift JIS value. Provide this function if you need support for Kanji mode.
margin Define how much wide the quiet zone should be. Default 4.
scale Scale factor. A value of 1 means 1px per modules (black dots). Default 4.
small Relevant only for terminal renderer. Outputs smaller QR code. Default false.
width Forces a specific width for the output image. If width is too small to contain the qr symbol, this option will be ignored. Takes precedence over scale.
color.dark Color of dark module. Value must be in hex format (RGBA). Note: dark color should always be darker than color.light. Default #0000ff
color.light Color of light module. Value must be in hex format (RGBA). Default #ffffff.

QRCode defaults to 115 x 115 pixels, but can be made larger.

QR Code uses the soldair/node-qrcode library.

Properties

Standard properties are supported, plus:

setValue(text [,options]) The text to be converted to a QR Code. Can be a URL or any other text string. options is optional - see above. Run Time.
value The text to be converted to a QR Code. Can be a URL or any other text string. Design Time.

Events

Standard events are supported.

Example

//Image Example
Image1.onclick= function() {
  alert("Click!");
}

// To change an image at runtime, use one of:
QRCode1.setValue(Input1.value);
options = {width:200, margin: 1};
QRCode1.setValue(Input1.value, options);

// The functions can also be called directly:
QRCode.toCanvas(QRCode1, "george", options)

Function QRCode1_onclick()
  Msgbox "Click!"
End Function

' To change a QRCode at runtime, use one of:
QRCode1.setValue(Input1.value)
options = {width:200, margin: 1}
QRCode1.setValue(Input1.value, options)

' The functions can also be called directly:
QRCode.toCanvas(QRCode1, "george", options)

Output

Related Items

PictureBox