Where is the data from TVaCapture?

I'm trying to use VaCapture. My program transmits a string out the serial port to an external device, using "VaComm1.writetext", and expects a response string, which always starts with a '!' character, and ends with chr(#10) (line feed) character. I have set the 'datastart' and 'datafinish' properties accordingly, and have a 'VaCapture1Message routine... Where is the captured message? 


The argument for VaCaptureMessage has an argument I don't understand, and it's not explained in the documentation:

procedure TDemoform.VaCapture1Message(Sender: TObject; const Data: AnsiString);

What is the 'const Data: AnsiString' all about?

Data parameter should be the data received between your start & end marker.

Unfortunately, the 'capture message' event never occurs. If I use a Vacomm1.readtext' procedure instead, it all works:


procedure TDemoform.VaCapture1Message(Sender: TObject; const Data: AnsiString);
begin
{  memo1.Lines.Add('REPLY: '+Data);      }
end;



procedure TDemoform.VaComm1RxChar(Sender: TObject; Count: Integer);
begin
  memo1.Lines.Add('REPLY: '+Vacomm1.readtext)
end;

The reason I'd rather use the capture mechanism is that sometimes, when using the 'vacomm1.readtext' method, the reply message appears to be in two parts, not all together. I see, in your examples, the 'onRxchar' event is used to trigger a read of the entire string in the receive buffer, which seems to imply that the entire string got received before the 'onRxchar' event was recognized.... this strikes me as a dangerous assumption. I'd rather use either 'capture', or the reception of a line feed character, as the event which causes the program to read the line, which would insure that the entire message was received. I'd like to use an event to do this, but the porperties if VaComm include an 'eventChar' item, while the events include 'event1', and 'Event2'.... how do I arrange things so that the reception of a specified character triggers an event?

Did you connect VaComm to VaCapture?
If so, and the event OnMessage isn't triggered, I can only see that the start & finish pattern isn't matched in the received data or the start & finish pattern is configured wrong.

How do you 'connect' them? In the object inspector for VACapture, the 'comm' property shows 'VaComm1'.... is that what you mean? That happened automatically, when I added VaCapture to the form... I didn't do anything explicit.


Yes, connecting means assign the VaComm instance to VaCapture.Comm property.