|
Accueil → WINDEV 25 → WX - Leitura de Codigo de Barras sem usar a biblioteca Zxling apenas usando a camera |
WX - Leitura de Codigo de Barras sem usar a biblioteca Zxling apenas usando a camera |
Débuté par BOLLER, 02 nov. 2017 16:11 - 1 réponse |
| |
| | | |
|
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 02 novembre 2017 - 16:11 |
Prezados,
Para nao usar a biblioteca do Zxling que baixa no celular o aoo Barcode reader devido o comando BCapture, vamos precisar que voce crie uma nova janela e nela coloque o controle camera fotografica.
No CODE do controle da camera fotografica coloque esse código
Procedure DecodeBarCode(bc is BarCodes) <Compile IF ConfigurationType=Android> VibrationTrigger(300) <ELSE> VibrationTrigger() <END> WIN_04_CacaTesouro_Menu.CodigoBarras(StringToUTF8(bc..Content))
Close()
Nas propriedades do controle de camera fotografica defina essa opção abaixo:
No botao que chama essa Window coloque:
OpenMobileWindow(WIN_BarCode)
Procedure CodigoBarras(sEdit_codigobarras is string) HourGlass(True) EDT_BarCode = sEdit_codigobarras
IF EDT_BarCode <> "" THEN ok is boolean = HReadSeekFirst(t006_campanhasXprodutos,t006_campanhasXprodutos.t006_codigoProduto,EDT_BarCode,hKeepFilter) IF HFound(t006_campanhasXprodutos) = True AND ok = True ok = WS_CapturaEAN(EDT_BarCode,gbCapturado) IF ok = True THEN Som_OK() CriaLoopers(0) sNomeProduto is string = t006_campanhasXprodutos.t006_nome_produto OpenMobileWindow(WIN_05_CacaTesouro_ListaDetalheItem,EDT_BarCode,gbCapturado) WIN_04_CacaTesouro_Menu..Plane = 3 ELSE Som_Erro() END
ELSE Som_Erro() Error("Produto não encontrado na base de dados") END
END HourGlass(False)
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 02 novembre 2017 - 16:14 |
Hi Adriano,
Some information:
The CBCapture FUNCTION uses the Zxing library (http: IF this library is not present on the device, its download will be automatically proposed, the download of this library also installs an integrated visualization application.
IN order not to have this download IN addition to the WINDEV Mobile Android application, you should not Use CBCapture, but put a window with a camera field, with the BarCode decoding option IN the details of the field Description, AND a BarCode decoding option IN the field decoding code of this type:
=====
A função CBCapture usa a biblioteca Zxing (http: Se esta biblioteca não estiver presente No dispositivo, seu download será proposto automaticamente, o download desta biblioteca também instala um aplicativo de visualização integrado.
Para não ter este download além DO aplicativo WINDEV Mobile Android, você não deve usar o CBCapture, mas coloque uma janela com um campo de câmera, com a opção de decodificação de código de barras nos detalhes da descrição DO campo e uma opção de decodificação de código de barras em o código de decodificação de campo deste tipo:
=====
Procedure CodeBarDecode(cbRead is a< /font> BarCode) <Compile IF ConfigurationType=Android> VibrationTrigger(500) <ELSE> VibrationTrigger() <END>
SWITCH cbRead..ContentType CASE bcTypeEmail EmailReset() Email.NbRecipient = 1 Email.Recipient[1] = cbRead..Content Email.Subject = "Post subject" Email.Message = "Text of the message" EmailRunApp() IF ErrorOccurred THEN Error("Unable to display the email sending window",ErrorInfo()) END
CASE bcTypePhone tapiDialerCall(cbRead..Content) IF ErrorOccurred THEN Error("Cannot call the phone",ErrorInfo()) END
CASE bcTypeSMS SMSReset() SMS.Subscript=1 SMS.Message="Message sms" SMS.Number=cbRead..Content SMSRunApp() IF ErrorOccurred THEN Error("Unable to send an SMS",ErrorInfo()) END
CASE bcTypeContact IF YesNo(StringBuild([ Add to contact ? %1 %2 %3 %4 ],mContact.FirstName,mContact.Name,mContact.OfficePhone+" "+mContact.HomePhone+" "+mContact.MobilePhone,mContact.Email)) THEN UnContact is a Contact UnContact.Nom = mContact.Name UnContact.Prénom = mContact.FirstName
uneAdresse is an Address IF mContact.OfficeAddress<>"" THEN uneAdresse.Rue=mContact.OfficeAddress <Compile IF ConfigurationType=Android> uneAdresse.Type=addressWork <ELSE> uneAdresse.Etiquette="Bureau" <END> Add(UnContact.Adresse,uneAdresse)
END IF mContact.HomeAddress<>"" THEN uneAdresse.Rue=mContact.HomeAddress <Compile IF ConfigurationType=Android> uneAdresse.Type=addressHome <ELSE> uneAdresse.Etiquette="Domicile" <END> Add(UnContact.Adresse,uneAdresse)
END
unTel is a Phone IF mContact.OfficePhone<>"" THEN unTel.Numéro=mContact.OfficePhone
<Compile IF ConfigurationType=Android> unTel.Type=phoneWork <ELSE> unTel.Etiquette="Bureau" <END> Add(UnContact.Téléphone,unTel) END IF mContact.HomePhone<>"" THEN unTel.Numéro=mContact.HomePhone <Compile IF ConfigurationType=Android> unTel.Type=phoneHome <ELSE> unTel.Etiquette="Domicile" <END> Add(UnContact.Téléphone,unTel) END IF mContact.MobilePhone<>"" THEN unTel.Numéro=mContact.MobilePhone
<Compile IF ConfigurationType=Android> unTel.Type=phoneCellHome <ELSE> unTel.Etiquette="Mobile" <END> Add(UnContact.Téléphone,unTel) END tabSource is array of ContactSource = ContactListSource() Source is a ContactSource IF NOT ErrorOccurred THEN FOR ALL ELEMENT Source OF tabSource IF Source..Type = " com.google " THEN BREAK END END END IF Source..Type <>"" THEN ContactAdd(UnContact,Source) ELSE ContactAdd(UnContact,Source) END
END
CASE bcTypeLocation gPos is a geoPosition=cbRead..Content geoRunApp(gPos) IF ErrorOccurred THEN Error("Cannot launch the map",ErrorInfo()) END
CASE bcTypeMarket ShellExecute(cbRead..Content) IF ErrorOccurred THEN Error("Cannot start the store",ErrorInfo< font style="font: 12px/normal Lucida Console; color: rgb(0, 0, 0); font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255);">()) END
CASE bcTypeWiFi ToClipboard(ExtractString(cbRead..Content,3,TAB)) ToastDisplay("The network password <"+ExtractString(cbRead..Content,1,TAB)+"> has been copied to the clipboard")
OTHER CASE sInfoCodeBarre is string ANSI=StringToUTF8(cbRead..Content) bTraite is boolean
IF sInfoCodeBarre[[TO 4]]~=StringToUTF8("HTTP") THEN bTraite=True BrowserRunApp(sInfoCodeBarre)   ; IF ErrorOccurred THEN Error("Unable to launch Internet browser",ErrorInfo()) END END
IF sInfoCodeBarre[[TO 7]]~=StringToUTF8("MATMSG:") THEN bTraite=True EmailReset() Email.NbRecipient = 1 Email.Recipient[1] = ExtractString(ExtractString(sInfoCodeBarre,2,"TO:"),1,";") Email.Subject = ExtractString(ExtractString(sInfoCodeBarre,2,"SUB:"),1,";") Email.Message = ExtractString(ExtractString(sInfoCodeBarre,2,"BODY:"),1,";") EmailRunApp() IF ErrorOccurred THEN Error("Unable to display the email sending window",ErrorInfo()) END END
IF sInfoCodeBarre[[TO 12]]~=StringToUTF8("BEGIN:VEVENT") THEN sInfoCodeBarre=StringToUTF8("BEGIN:VCALENDAR"+CR)+sInfoCodeBarre< /font>+StringToUTF8(CR+"END:VCALEN DAR") END IF sInfoCodeBarre[[TO 15]]~=StringToUTF8("BEGIN:VCALENDAR") THEN tabRDV is array of Appointment=iCalendarToAppointment(sInfoCodeBarre)
IF tabRDV..Occurrence>0 THEN bTraite=True nIndiceCalendrier is int FOR EACH unRDV OF tabRDV nIndiceCalendrier=0 &nb sp; IF YesNo(StringBuild([ Add Appointment '%3' du %1 to %2 ? ],DateToString(unRDV..StartDate..Date,"JJJJ JJ MMMM AAAA"),TimeToString(unRDV..StartDate..Time,"HHhMM"),unRDV..Title)) THEN tabCalendrier is array of Calendar = AppointmentListCalendar() SWITCH tabCalendrier..Occurrence CASE 0 Info("Adding impossible there is no calendar") RETURN CASE 1 nIndiceCalendrier=1
OTHER CASE FOR n=1 _TO_ tabCalendrier..Occurrence IF YesNo("Add the appointment to the calendar "+tabCalendrier[n]..Name+"-"+tabCalendrier[n]..AccountName+" ?") THEN nIndiceCalendrier=n BREAK END END
END IF nIndiceCalendrier>0 THEN AppointmentAdd(tabCalendrier[nIndiceCalendrier],unRDV) IF NOT ErrorOccurred THEN ToastDisplay("Appointment added") ELSE Error("Failed to add appointment",ErrorInfo()) END END END END END END
IF NOT bTraite THEN ToClipboard(sInfoCodeBarre) Info("Information retrieved (published in the clipboard) : ",sInfoCodeBarre) END END
Please DO not hesitate to Contact me for any additional information.
PCSOFT Véronique BRUNIER Assistance Directe
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/Message modifié, 02 novembre 2017 - 16:16 |
| |
| |
| | | |
|
| | | | |
| | |
|