Perspective - Barcode Scanner Input
Component Palette Icon:
Description​
The Barcode Scanner Input component awaits for input from a barcode scanner. The component was designed for keyboard wedge scanners, as the component provides dedicated prefix and suffix properties to define scanner input. As such, it can be useful to think of the Barcode Scanner Input component as a specialized text field that does not require focus, and uses characters to decide when to accept and reject text input.
The scanner component is continuously listening, waiting for either the prefix and suffix characters to be entered, or the regex pattern to find a match. Once triggered, the component will load the scanned barcode string (excluding the prefix and suffix) into the data property for processing. The regex property can be used to extract specific fields from a scan, or validate data from the scan.
Properties​
Most Properties have binding options. For more information on Bindings, see Types of Bindings in Perspective. This section only documents the Props Category of properties. The other Categories are described on the Perspective Component Properties page.
| Name | Description | Property Type |
|---|---|---|
| prefix | String value that mark the start of the barcode scan capture. If a value is provided to this property, then the regex property will be ignored. | value: string |
| suffix | String value that marks the end of the barcode scan capture. If a value is provided to this property, then the regex property will be ignored. | value: string |
| regex | Regex describing the format of scans. The first capture will be used as barcode. When used, this property will pull out the first group of any regex provided. Note that this setting uses Javascript regex, as opposed to other flavors of regex. If either a prefix or suffix value is specified with a non-empty string, then this property will be ignored. | object |
| window | Length of buffer to monitor for regex match. | value: numeric |
| captureMode | Indicates which key event the component will listen for to start the barcode scan capture. Values include keypress, keyup, and keydown. Default value is keypress. | value: string |
| data | Barcode scans returned from scanner. | array |
| dataStyle | Sets a style for data returned to this component. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class. | object |
| style | Sets a style for this component. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class. Styles can can be set on the component before a value is scanned. | object |
Component Scripts and Events​
Further component interaction and functionality can be configured for all components through scripting and event actions. Right-click on the component or select Components from the Designer menubar to access the configuration popups for both of these options:
- Configure Events: Accesses the Event Configuration popup where you can configure actions to run in response to events to make the component dynamic. The Events Configurations page shows how to configure events and actions on a Perspective component.
- Configure Scripts: Accesses the Script Configuration popup where custom methods and message handlers can be added. The Scripting in Perspective section details scripting fundamentals, creating custom methods, and using message handlers.