barcode reader as input...

im using a barcode reader as input...

the problem is...
i like to disable the keyboard input...

hope for your kind answers...

best regards,
marc

Comments

  • : im using a barcode reader as input...
    :
    : the problem is...
    : i like to disable the keyboard input...
    :
    : hope for your kind answers...
    :
    : best regards,
    : marc
    :
    i do not see you're problem, what do u want to disable the key input for a TEdit ?
    if u want to disable key input in a basic delphi componenet than u can use the OnKeyDown event like this.
    [code]procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
    Shift: TShiftState);
    begin
    Key := 0;
    end;[/code]

    i hope this helps u,

    greets SRK
  • : i do not see you're problem, what do u want to disable the key input for a TEdit ?
    : if u want to disable key input in a basic delphi componenet than u can use the OnKeyDown event like this.
    : [code]procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
    : Shift: TShiftState);
    : begin
    : Key := 0;
    : end;[/code]
    :
    : i hope this helps u,
    :
    : greets SRK
    :

    if you use that code then you could not get the input from the barcode reader... Edit1.Text will have an empty string;

    is there another way?

    thanks for your reply....

    best regards,
    marc


  • : : i do not see you're problem, what do u want to disable the key input for a TEdit ?
    : : if u want to disable key input in a basic delphi componenet than u can use the OnKeyDown event like this.
    : : [code]procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
    : : Shift: TShiftState);
    : : begin
    : : Key := 0;
    : : end;[/code]
    : :
    : : i hope this helps u,
    : :
    : : greets SRK
    : :
    :
    : if you use that code then you could not get the input from the barcode reader... Edit1.Text will have an empty string;
    :
    : is there another way?
    :
    : thanks for your reply....
    :
    : best regards,
    : marc
    :
    :
    :
    You can set the ReadOnly property to true. This way the edit functions more or less as a TLabel.
  • [b][red]This message was edited by Masterijn at 2004-5-1 2:4:12[/red][/b][hr]
    : im using a barcode reader as input...
    :
    : the problem is...
    : i like to disable the keyboard input...
    :
    : hope for your kind answers...
    :
    : best regards,
    : marc
    :
    You can set the TForm.KeyPreview = True. In this way you don't need an extra focussed control. But the keydown/keyup handling is form global this way. This is a template you could use, the VK_PAUSE is the preamble (i think its called that way):
    [code]
    procedure TfrmMain.FormKeyDown(Sender: TObject; var Key: Word;
    Shift: TShiftState);
    begin
    if Assigned(FBarcodeReader) then
    begin
    Key := 0;
    end
    else if (Key = VK_PAUSE) then
    FBarcodeReader := TReadBarcode.Create;
    end;


    procedure TfrmMain.FormKeyPress(Sender: TObject; var Key: Char);
    begin
    if Assigned(FBarcodeReader) then
    begin
    if (Key <> #13) then
    FBarcodeReader.PushChar(Key);
    Key := #0;
    end;
    end;

    procedure TfrmMain.FormKeyUp(Sender: TObject; var Key: Word;
    Shift: TShiftState);
    begin
    if Assigned(FBarcodeReader) then
    begin
    if Key = VK_RETURN then
    begin
    try
    Key := 0;
    with FBarcodeReader do
    begin
    Process;
    end;
    finally
    FreeAndNil(FBarcodeReader);
    end;
    end
    end;
    end;
    [/code]






  • You can set the TForm.KeyPreview = True. In this way you don't need an extra focussed control. But the keydown/keyup handling is form global this way. This is a template you could use, the VK_PAUSE is the preamble (i think its called that way):
    : [code]
    : procedure TfrmMain.FormKeyDown(Sender: TObject; var Key: Word;
    : Shift: TShiftState);
    : begin
    : if Assigned(FBarcodeReader) then
    : begin
    : Key := 0;
    : end
    : else if (Key = VK_PAUSE) then
    : FBarcodeReader := TReadBarcode.Create;
    : end;
    :
    :
    : procedure TfrmMain.FormKeyPress(Sender: TObject; var Key: Char);
    : begin
    : if Assigned(FBarcodeReader) then
    : begin
    : if (Key <> #13) then
    : FBarcodeReader.PushChar(Key);
    : Key := #0;
    : end;
    : end;
    :
    : procedure TfrmMain.FormKeyUp(Sender: TObject; var Key: Word;
    : Shift: TShiftState);
    : begin
    : if Assigned(FBarcodeReader) then
    : begin
    : if Key = VK_RETURN then
    : begin
    : try
    : Key := 0;
    : with FBarcodeReader do
    : begin
    : Process;
    : end;
    : finally
    : FreeAndNil(FBarcodeReader);
    : end;
    : end
    : end;
    : end;
    : [/code]
    :


    thanks for the reply... but i dont have TReadBarcode and i dont know how to make TReadBarcode...
    hoping for your reply...
    thanks and best regards,
    marc



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories