Platforms to show: All Mac Windows Linux Cross-Platform
/Picture/Barcode recognition/Barcode recognition Web
Required plugins for this example: MBS Picture Plugin, MBS Images Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Barcode recognition/Barcode recognition Web
This example is the version from Sat, 14th Jan 2022.
Project "Barcode recognition Web.xojo_binary_project"
Class App Inherits WebApplication
End Class
Class Session Inherits WebSession
Const ErrorDialogCancel = "Do Not Send"
Const ErrorDialogMessage = "This application has encountered an error and cannot continue."
Const ErrorDialogQuestion = "Please describe what you were doing right before the error occurred:"
Const ErrorDialogSubmit = "Send"
Const ErrorThankYou = "Thank You"
Const ErrorThankYouMessage = "Your feedback helps us make improvements."
Const NoJavascriptInstructions = "To turn Javascript on, please refer to your browser settings window."
Const NoJavascriptMessage = "Javascript must be enabled to access this page."
End Class
Class MainPage Inherits WebPage
Control List Inherits WebListBox
ControlInstance List Inherits WebListBox
End Control
EventHandler Sub Opening()
test FindFile("barcode1.jpg")
test FindFile("barcode2.gif")
test FindFile("barcode3.gif")
End EventHandler
Function FindFile(name as string) As FolderItem
// Look for file in parent folders from executable on
dim parent as FolderItem = app.ExecutableFile.Parent
while parent<>Nil
dim file as FolderItem = parent.Child(name)
if file<>Nil and file.Exists then
Return file
end if
parent = parent.Parent
wend
End Function
Function PictureOpen(f as FolderItem) As Picture
dim p as Picture = Picture.Open(f)
if p<>Nil then
Return p
end if
dim g as GifMBS = f.OpenAsGIFMBS
if g<>Nil then
Return g.MakeFirstPictureWithMask
end if
End Function
Sub test(f as FolderItem)
if f.Exists = False then
list.AddRow f.name + ": missing"
Return
end if
dim b as new BarcodeScannerMBS
'b.CheckDigits=false
'b.MinimumLength=0
dim p as Picture = PictureOpen(f)
if p = nil then
list.AddRow f.name + ": can't read"
Return
end if
if b.Scan(p) then
list.AddRow f.name + ": " + b.Barcode
else
list.AddRow f.name + ": failed"
end if
End Sub
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Picture Plugin.