LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange Text Box Behaviour

I have a text box acting as a terminal window for a TCP client. When I receive data over the TCP link and send it to the text box, I seem to get random blank lines between some the lines of text. Acting as though there are two '\n' at the end of the line. The strange thing is, if I then type one character or more and then press the backspace key the blank lines in the block of text disappear and all the text below a blank line moves up.
Any ideas how to stop this behaviour?
0 Kudos
Message 1 of 3
(2,829 Views)
It sounds like you could be getting null characters sent over the TCP link. Search for and remove null characters from the string before you display it and see if the blank lines still appear.

Jon Bowers
Applications Engineer
NI UK
0 Kudos
Message 2 of 3
(2,829 Views)

Had this problem too. I perform ComRd inside the callback installed by InstallComCallback

on a serial interface (COM port on Windows 7).

Sometimes it happens that the last character in the buffer is a CR. If I give that buffer to 

the textbox (SetCtrlVal(panel, textboxctrl, buf)) then the next time the callback is called it will

have a LF at the beginning. Doing a SetCtrlVal on this buffer will give an empty line.

 

Solution to this was to check if the last character received was a CR and if so, capture the

following LF (ComRd(comPort, buf, 1) ) and then use SetCtrlVal.

 

I guess this shouldn't be a problem in a Linux environment

0 Kudos
Message 3 of 3
(2,447 Views)