Author Topic: nrDataProcessor and TEvent  (Read 1418 times)


  • Newbie
  • *
  • Posts: 15
    • View Profile
nrDataProcessor and TEvent
« on: January 26, 2011, 12:47:54 pm »
I got a problem regarding nrDataProcessor.OnDataPacket in conjunction with TEvent objects (Delphi 2007 (nrCommLib 9.12).
Right now I have a nrDataProcessor.OnDataPacket running and when it parsed a datagram it sets a flag to true. In my main application I poll that flag for true to continue in my code.
It's working, but not a good idea. Now I want to use a TEvent object as they seem to be made for that purpose.
I create an instance of TEvent in FormCreate.
Code: [Select]
myEvent := TEvent.Create(nil, True, False, '');

Now my nrDataProcessor.OnDataPacket doesn't set the flag anymore, but does a
Code: [Select]
at the end.

My main application is waiting with
Code: [Select]
  case mDataPacketCompleteEvent.WaitFor(500) of
    wrSignaled: begin
    wrTimeout: begin
    else begin

Now it always runs into the 'wrTimeout' branch.
I tried to set "UseMainThread" to True/False: no change.
Any chance to use TEvents correctly here?