#1
  1. My beer is empty....
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    South Africa
    Posts
    73
    Rep Power
    13

    event handler in console mode


    I'm using the TurboPower Async Professional CLX in a console mode application.

    1. Assigning an event handler in console mode
      I need to assign an event handler. I know that in a TComponent/TForm you put the function in your private declarations and the assign it to the onEvent property:

      procedure comPortTrigger(CP: TObject; Msg, TriggerHandle, Data: Word);

      comPort.onTrigger := comPortTrigger;

      When trying this in a console application I get:

      [Error] Project1.dpr(19): Incompatible types: 'method pointer and regular procedure'

      How do I get this right?
    2. Getting the components to work in console mode
      The TurboPower Async Professional CLX components work like a charm as long as I coding a visual application. When coding a console application it does not work. The application I'm writing will run as a service on a Linux machine and must be able to read/write data from several devices (up to 32) connected via serial ports (multi port boards - using the Moxa CP114s at the moment). If you can tell me how to get it fixed it would be muched appreciated.

      Alternatively please recommend (or guide me in writing) components that can read/write from serial ports coded in Kylix (or using DLL's). Must run in Linux though. The devices output under full load about 9.6kB(yte) per second per port and we need to write to that same port whilst reading (or stop reading, write, continue reading) without the system falling over.
    Last edited by Domisedon; May 14th, 2004 at 08:14 AM.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,595
    Rep Power
    4207
    I described how to do button events dynamically in this thread:
    http://forums.devshed.com/t143784/s.html

    The principle is the same for any event handler. Only the number of parameters and their types will differ depending upon the event.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. My beer is empty....
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    South Africa
    Posts
    73
    Rep Power
    13
    Thanks - but I tried it and it doesn't work. It seems that you cannot do event handlers in a console application without writing an additional class.

    The big thing I've got to do is get serial port access and the components I've got just don't do the job in console mode.

    Any help would be greatly appreciated

IMN logo majestic logo threadwatch logo seochat tools logo