[Lazarus] Fw: Re: One last ask for help

Antonio Fortuny a.fortuny at sitasoftware.lu
Thu Mar 21 16:26:01 CET 2013



Le 21/03/2013 15:02, "Arí Ricardo Ody" a écrit :
> Hi Ricardo. ---> Hi Antonio As of my last experience (Datalogic, Motorola former Symbol models, all using WinCE)
the scanner itself needs to be very carefully configured. --->Can tell 
little bit more about this?
Depends on each model. There should be some kind of program to set the 
scanner config
Usually tap button Windows, on the applications screen select Settings, 
then there should be a program specific to the hardware having a barcode 
icon of so.

---> In my application user must see the code scanned. Are you 
suggesting that I can't see the code because I wait the input in a TEdit?
No, it seems that the characters from the scaaner are not sent to the 
wright place
If I use a TLabel it will be showed?
You can"t manage to use a direct input as the TLabel is not input 
capable. You can only change the caption by assignment

---> What is the exactly use of this event in this case?
set MyForm.KeyPreview to True;
set MyForm.OnKeyPress to an event (i.e. MyFormKeyPress)

procedure TMyForm.FormKeyPress(Sender: TObject; var Key: char);
begin
   case Ord(Key) of
     {$IFDEF WIN32}
     Ord('>'),  // this helps to simulate on Win32
     {$ENDIF}
     Ord(#03): begin   // aka EOT
       Key := #0;
       try
         if Scann.Buffer = EmptyStr then
           Exit;
         codebarre := scann.buffer;
         ...
         ... do whatever has to be done with the scannes barcode
         ...
       finally
         Scann.Reset;
         Scann.Reading := False;
       end
     end;
     {$IFDEF WIN32}
     Ord('<'),   // this helps to simulate on Win32
     {$ENDIF}
     Ord(#02): begin   // aka STX
       Scann.Reset;
       Key := #0;   // ignore key
       Scann.Reading := True;
     end
     else begin
       Scann.Buffer := Scann.Buffer + Key;
       Key := #0;   // ignore key
     end
   end

end;

I open a nem porject in Lazarus 1.0 RC1(Is the only one I have in this 
machine in my work) and can't find the KeyPreview event.
see above






More information about the Lazarus mailing list