I know the differences with embedded (I use PIC and interrupts for all my RX stuff and its extremely reliable), but there are significant differences in the PC and how it handles the data.
the main difference is the use of an EVENT based system in Xojo.
there are no guarantees at any point that what you send from the embedded device actually gets presented to you in the DataAvailable event of the serial port in one lump as you may hope.
in fact its just as likely you get 1 byte or all of it, it depends on everything else going on in the computer.
basically you can not depend on the receive event as an arbiter of packets sent, its not designed to be that beast.
there are several ways to tackle it, one might be (to make it more reliable) is to send much smaller packets which each have some form of end character and then the last one has a different character to indicate the end.
sending 1000 characters and expecting them all to end up completely correct in the buffer is a bit optimistic if you ask me, without some message management (you are doing something similar to my current project which is a PIC and Pi).
as I mentioned in my initial post, trying to do your complete project immediately is likely to end in some frustration.
a smaller test with say 20 bytes is likely to be more useful as initial testing.
also you do not mention baud rate, in my experience any testing above 19200 is likely to introduce unexpected issues, make sure the code is good in the computer before going higher, not all USB serial adaptors work as well as you might hope and longer than a couple of meters cable is asking for trouble with single ended hardware.
next option is what to do in the DataAvailable event, for testing purposes I would do this in the event, but in reality the code in any event should be as small as possible and call a method to do any processing.
the main options are ReadAll and LookAhead.
ReadAll will empty the current contents of the Serial buffer into your own string property, MySerialRXData as string, for example:-
in the DataAvailable event:-
MySerialRXData=me.ReadAll
you do not need to tell the string how big it needs to be, it will grow up to ram limit I think.
when you have the data in MySerialRXData you will need to see if the last character is as you put it, you will need to specify what is by using Chr(10) or Chr(13) depending what you send for >CR<:-
this would be done using the string functions Right or Mid to look at the last character in the buffer and compare it with Chr(10) etc.
you can then show the results in a textfield:-
mytextfield.text= MySerialRXData
the second option, and the one I might prefer in the scenario described in this test, is to use LookAhead.
LookAhead will read the serial buffer data and allow it to be tested but does not empty the contents from the receive buffer.
this is similar code I use in my own routines with changes to the names:-
If right(me.LookAhead,1)=Chr(10) then
//do something with the data received.
MySerialRXData=me.ReadAll
mytextfield.text= MySerialRXData
end
all of this is just a version of the barcode example.