Marc Santhoff wrote:
Am Freitag, den 21.04.2006, 22:28 +0100 schrieb Ian bell:

I am just starting to port some programs to fpc using Lazarus form Tcl/Tk. I have some questions about things I can do fairly easily in Tcl/Tk which I am not sure how to achieve in fpc/lazarus. At present I only need Linux specific answers.

1. I am connecting to an external microcontoller development board by a serial interface. I need to be able to set this interface non blocking. I can see how to open the serial interface using the serial unit but it is not clear how to set it non blocking.


For Linux/*nix there is the "serial" unit, does something similar here.
See

<fpc-source-dir>/rtl/unix/serial.pp


Yes, as I mentioned above I looked at the 'serial' unit. It seems to basicaly call fpopen as expected. To set the serial port paramaters, which includes blocking, a call to ioctl is normaly needed which appears to be implemented by a call to tcsetattr which I assume is in the termio unit. I have now tracked this down and the tcsetattr seems to be inplemented by a cal to fpioctl -surprise surprise! The only other unit used by termio is BaseUnix. However I can only find baseunix.ppu in the source tree - is there some utility that can make these human readable?

2. I need to respond to the occurence of input on the serial port. This is trivial in Tcl - fileevent FileDescriptor FunctionName - how do I achieve this in fpc?


Hum, not sure about this, but maybe a "select" on the port will help?
Another possibility would be to watch the status lines (in a separate
thread if necessary) or simply the input data ... depend on what event
you're waiting for.


I think this is an additional filed in the termios structure which I gues is the same as the one used in C.


3. In Tcl/Tk I use a textarea widget with keyboard entry disabled to show progress and data. The nearest equivalent in LCL seems to be TMemo. How do I disable keyboard input to this and where can I find documentation on this and other) components - the wiki seems fairly silent on this or do I just assume it work like a Delphi TMemo?


I think setting the property "ReadOnly" to TRUE should do.

Most people seem to use Delphis docs because they have used it before
trying fpc/lazarus. For the basics mostly any doc about Delphi/Object
Pascal would do (from the web, cheap books, ...).


That's handy; I stopped using Deplhi at V3 but I still have the books.

Thanks for the help.

Ian

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to