Recent

Author Topic: TEdit not processing LF/CR input  (Read 5017 times)

alcides_fp

  • Newbie
  • Posts: 1
TEdit not processing LF/CR input
« on: January 30, 2011, 11:03:18 pm »
Hello everybody...

Im migrating an application that I developed in Delphi5 for Windows to Debian GNU/Linux using Lazarus with GTK2.
This application works with a barcode scanner as one of its input methods.
Im using a little program called softwedge (http://www.stackfoundry.com/other/softwedge) to redirect input form the barcode scanner (/dev/ttyUSB0 in my case) to the X11 keyboard.
This works great in all other applications (v.gr. OpenOffice, gedit, geany, emacs, Gtk2 apps, Qt4 apps, wxWidgets apps, etc, etc).

BUT, for some strange reason IT DOES NOT WORK neither in my Lazarus application nor in the Lazarus IDE.
The TEdit component and all its descendants (v.gr. TMaskEdit) doesnt seem to be recognizing/processing the LF/CR at the end of the character stream that is being read from the barcode scanner.

This is pretty strange as my Lazarus app and the Lazaurs IDE itself are the only ones exhibiting this strange behaviour.
I put some hooks in the OnKeyDown and OnKeyPress events and it seems to me that the "EchoMode" feature of the TEdit is filtering/removing the LF (#10) char. I have to manually strike ENTER on the keyboard to get it recognized, which in this context is simply annoying and no-sense.

I dont know how to solve this.

Any clue will be highly appreciated.

Im in Debian Squeeze using the Lazarus 0.9.28.2-12 Debian packages with FPC 2.4.0

Greetings..


Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
Re: TEdit not processing LF/CR input
« Reply #1 on: January 31, 2011, 12:53:43 am »
There is a difference between a single line edit (like TEdit) or a multiline edit (like TMemo)
On a sinlge line edit a "enter" has a special meaning and is not sent as character (iirc) (I recall something about a WantRetunrs property)

Of all the apps you tried, did you send the input to the memo like control (I assume you did for openoffice/gedit etc) or to a line control ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: TEdit not processing LF/CR input
« Reply #2 on: January 31, 2011, 08:04:50 am »
Im using a little program called softwedge (http://www.stackfoundry.com/other/softwedge) to redirect input form the barcode scanner (/dev/ttyUSB0 in my case) to the X11 keyboard.

I hope that /dev/ttyUSB0 is not hard-coded but a configurable thing at your application.
Furthermore, you should use the uuid of the device rather then the dev, and then when it's connected you can always find it regardless of the device "file" that was created for it.

My 2 cents

 

TinyPortal © 2005-2018