4D v13.4Using the element zero of an array |
||
|
4D v13.4
Using the element zero of an array
Using the element zero of an array
An array always has an element zero. While element zero is not shown when an array supports a form object, there is no restriction(*) in using it with the language. One example of the use of element zero is the case of the combo box discussed in the section Arrays and Form Objects. Here are two other examples. ` atNames scrollable area object method 2. In ASCII compatibility mode, when sending or receiving a stream of characters to or from a document or a serial port, 4D provides a way to filter ASCII codes between platforms and systems that use different ASCII maps— the commands USE CHARACTER SET, Mac to ISO, ISO to Mac, Mac to Win and Win to Mac. In certain cases, you might want to fully control the way ASCII codes are translated. One way to do this is to use an Integer array of 255 elements, where the Nth element is set to the translated ASCII code for the character whose source ASCII code is N. For example, if the ASCII code #187 must be translated as #156, you would write ◊aiCustomOutMap{187}:=156 and ◊aiCustomInMap{156}:=187 in the method that initializes the interprocess arrays used everywhere in the database. You can then send a stream of characters with the following custom project method: ` X SEND PACKET ( Text { ; Time } ) In this advanced example, if a stream of characters containing NULL characters (ASCII code zero) is sent or received, the zero element of the arrays ◊aiCustomOutMap and ◊aiCustomInMap will play its role as any other element of the 255 element arrays. (*) However, there is one exception: in an array type List Box, the zero element is used internally to store the previous value of an element being edited, so it is not possible to use it in this particular context. |
PROPERTIES
Product: 4D SEE ALSO |