TWSocket.LineEdit
Definition
property LineEdit: Boolean;
Description
LineEdit allows the automatic transliteration of certain control characters into their visual representation. In particular, the BACKSPACE (ASCII #08) and TAB (ASCII #09) characters.
When LineEdit is set to True, any BACKSPACE character encountered in the input buffer will cause the buffer position pointer to move back one character, thus deleting it. Likewise, every TAB character will cause the buffer to be padded with the number of SPACE (ASCII #32) characters needed to reach the next tabular column. A tabular column is typically 8 spaces.
LineEdit is typically used in conjunction with LineMode when the incoming data needs to be displayed to a terminal.
Example
<syntaxhighlight lang="delphi">
Socket.LineMode := True; // Enable LineMode Socket.LineEnd := chr(10)+chr(13); // The sender has to terminate all // messages sent with this character // combination Socket.LineEdit := True; // Convert backspaces and tabs
</syntaxhighlight>
When the following input string is received from a client connection (note that ^H represents a backspace character):
This is a new^H^H^Htest.
TWSocket will convert it to the following:
This is a test.
When the following input string is received from a client connection (note that ^T represents a tab character):
^TCol1^TCol2^T^TCol3
TWSocket will convert it to the following (the ruler represents the position of the tabular columns):
Tab0 Tab1 Tab2 Tab3 Tab4 |-------+-------+-------+-------+-------| Col1 Col2 Col3