4D v15List box, Creating columns with dynamic variables |
||||||||||||||||||||||||||||||||||||
|
4D v15
List box, Creating columns with dynamic variables
|
LISTBOX INSERT COLUMN ( {* ;} object ; colPosition ; colName ; colVariable ; headerName ; headerVar {; footerName ; footerVar} )
|
||||||||||||||||||||||||
These commands now accept a Nil pointer (->[]) as a value for the colVariable (when applicable), headerVar and footerVar parameters. In this case, 4D will create the required variables dynamically when the commands are executed (see the "Dynamic variables" section in the 4D Language manual for more information).
Note that header and footer variables are always created with a specific type (respectively, long integer and text). However, the column variable cannot be typed at creation because the listbox accepts different types of arrays for this variable (text array, integer array, etc.) so you must set the type of the array manually. For example:
C_POINTER($NilPtr)
LISTBOX INSERT COLUMN(*;"MyListBox";1;"MyNewColumn";$NilPtr;"MyNewHeader";$NilPtr)
ColPtr:=OBJECT Get pointer(Object named;"MyNewColumn")
ARRAY TEXT(ColPtr->;0) // Replace 0 by a positive value if you want to preallocate elements in the array
It is important to do this typing before using commands like LISTBOX INSERT ROWS to insert new elements in the array. Alternatively, it is possible to use APPEND TO ARRAY both to type the array and start inserting elements at the same time.
Product: 4D
Theme: Language
4D v15 - Upgrade (standard edition) ( 4D v15)