Jump to content

Recommended Posts

Posted

Hi,

 

Please look at the demo example \FMSoft\Framework\uniGUI\Demos\Desktop\LoginForm Cookies

 

TUniMainModule.UniGUIMainModuleBeforeLogin

 

Best regards,

Posted

It depends on what the "barcode" means and what you want to do...is not clear from your question but you can also use a REST call and the UniGUIServerModuleHTTPCommand event of TUniServerModule....I use it for reports...see below.

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo;
  AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);
var
  dm : TdmReportData;

begin
  if ARequestInfo.URI='/report/finsummary' then
  begin
    dm := TdmReportData.Create(nil);
    try
      dm.qryReport.Connection := dm.FDConnection;
      AResponseInfo.ContentText := dm.GenerateReportPDF(repFinSummary, '') + ' header [user] = ' + ARequestInfo.RawHeaders.Values['user'];
      AResponseInfo.ResponseNo := 200;
      AResponseInfo.WriteContent;
      Handled := True;
    finally
      dm.Free;
    end;
 end;
end;
Posted

Idea is very simple.

I need check barcode in database with mobile device. I found QuickMark application. This application can recognize barcode by camera and open url with value after reading.

My application has login form. What I can do in this case?

1 use onShow event of the login form

2 use cookis and hide login form

3 httpcommand of the server module

 

Seems that second way is good solution

 

Thank you,

Dmytro Lendel

Posted

I use a UnimHTMLFrame and below is the HTML for it:

<section id="container" class="container">
    <div class="controls">
        <fieldset class="input-group">
            <button class="start x-button" style="height: 32px; width: 150px; color: #fff;">START SCANNING</button>
        </fieldset>
        <div class="reader-config-group">
            <label>
                <span>Camera</span>
                <select name="input-stream_constraints" id="deviceSelection" style="height: 32px;"></select>
            </label>
        </div>
    </div>
    <div id="result_strip">
        <ul class="thumbnails"></ul>
    </div>
    <div class="video-center">
      <div id="interactive" class="viewport"><video autoplay="true" preload="auto" src=""></video><canvas class="drawingBuffer" width="320" height="240"></canvas><br clear="all"></div>
    </div>
</section>


<script src="files/quagga/js/live_w_locator.js" type="text/javascript"></script>

In the last line you can see it loads the script "live_w_locator.js". You can get that file from the website as well as the quagga.js file. See the examples. Those files go into your files folder of the server...

 

I have modified the "live_w_locator.js" to do a Ajax call to the UniGUI Server when a code has been scanned successfully. (Note that below is just a snipped from "live_w_locator.js".)  

 

ajaxRequest(frmBarcodeScan.UnimHTMLFrame, 'scansuccess', ["barcode="+code])...see below:

Quagga.onDetected(function(result) {
        var code = result.codeResult.code;
		App.scannedCount ++;
		
		if (App.scannedCount < 2) {
            var $node = null;
            $node = $('<li><div class="thumbnail"><div class="caption"><h4 class="code"></h4></div></li>');
            $node.find("h4.code").html(code);
            $("#result_strip ul.thumbnails").prepend($node);
        } 
		else {
			Quagga.stop();
			App.scannedCount = 0;
			ajaxRequest(frmBarcodeScan.UnimHTMLFrame, 'scansuccess', ["barcode="+code]);
		}
    });

scannedCount is a variable I introduced as to how many scans must be done before it stops and send the array of values back.

 

Just remember you have to use https as for the camera access to work.

 

Here is a few images:

 

 

post-4617-0-77416000-1496640907_thumb.png

post-4617-0-17261000-1496641013_thumb.png

post-4617-0-17326600-1496641015_thumb.png

  • Upvote 1
Posted

The camera starts but the code scan unfortunately does not. The green frame around the code also does not exist. Maybe not all files have lost. Can you write more?

Posted

There are many types of Barcodes, you would need to adjust the decoder property array under the state object to cater for the expected types in the live_w_locator.js file.

decoder: {
                readers : ['ean_reader', 'ean_5_reader', 'ean_2_reader', 'code_128_reader']

See the examples on the Quagga website...in which case they have a drop down to select the type but you can pass it in as above. Remember the more you define the longer it might take to recognize it as it has to try all of them.

  • 7 years later...
Posted
On 6/3/2017 at 3:53 PM, Pink-El said:

I am sorry. I found solution. OnShow event of the login form.

Thank you

I tried to use the OnShow to set the ModalResult:=mrOK and it crashed. Can you tell me how you solved it?

Posted
1 hour ago, gerhardhziegler said:

I tried to use the OnShow to set the ModalResult:=mrOK and it crashed. Can you tell me how you solved it?

Hello,

If you don't want to lost your time, you have a complete, turnkey solution for a modest sum, from our friend marlon.

Easy to use and totally integrated to unigui :

http://forums.unigui.com/index.php?/topic/11359-falcon-store-components-delphi-httpsstorefalconsistemascombr/&do=findComment&comment=139534

I am using it and totally satified :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...