KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Inserting text in a array object based List Box
PRODUCT: 4D | VERSION: 15 | PLATFORM: Mac & Win
Published On: August 31, 2015

In v15, the array object can be used for the List Box. Data can be entered by the following for an array based List Box assuming that the array is initialized to a size with these two approaches:

1. Double clicking on the row to edit text shown below in red:



When the data is entered in that row, the debug window displays the area where it will be updated by 4D in red:



2. Inserting the text with the method INSERT_INTO_LISTBOX_ARR_OBJ programmatically as shown
below:

// ------------------------------------------------------------------------
// Name: INSERT_INTO_LISTBOX_ARR_OBJ
// Description: Method inserts text in a array object column of a Listbox.
//
// Parameters:
// $1 (Pointer) - Pointer to the column array in a Listbox.
// $2 (Longint) - Row to insert the data.
// $3 (Text) - Text data to insert in that row.
// ------------------------------------------------------------------------
C_POINTER($1;$col_name)
C_LONGINT($2;$row)
C_TEXT($3;$value)
C_OBJECT($obj)

If (Count parameters=3)
   $col_name:=$1
   $row:=$2
   $value:=$3

   OB SET($obj;"valueType";"text")
   OB SET($obj;"value";$value)
   $col_name->{$row}:=$obj
End if


Sample of using the method INSERT_INTO_LISTBOX_ARR_OBJ:

INSERT_INTO_LISTBOX_ARR_OBJ (->Column1;3;"GHI")

Result of inserting "GHI" on the 3rd row:


See Also: