Difference between revisions of "TWSocket.LineEdit"

From Overbyte
Jump to navigation Jump to search
(New definition page ~~~~)
 
Line 31: Line 31:
 
  <font color="darkblue">'''^T'''</font>Col1<font color="darkblue">'''^T'''</font>Col2<font color="darkblue">'''^T^T'''</font>Col3
 
  <font color="darkblue">'''^T'''</font>Col1<font color="darkblue">'''^T'''</font>Col2<font color="darkblue">'''^T^T'''</font>Col3
  
TWSocket will convert it to the following:
+
TWSocket will convert it to the following (the ruler represents the position of the tabular columns):
  <font color="gray">
+
  <font color="gray">Tab0    Tab1    Tab2    Tab3    Tab4
Tab0    Tab1    Tab2    Tab3    Tab4
+
  |-------+-------+-------+-------+-------|</font>
  |-------+-------+-------+-------+-------|
 
</font>
 
 
         Col1    Col2            Col3
 
         Col1    Col2            Col3
  

Revision as of 20:57, 3 December 2007

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

 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

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

Best practices

How to