4D v14.3

LISTBOX DUPLICATE COLUMN

Home

 
4D v14.3
LISTBOX DUPLICATE COLUMN

LISTBOX DUPLICATE COLUMN 


 

LISTBOX DUPLICATE COLUMN ( {* ;} object ; colPosition ; colName ; colVariable ; headerName ; headerVar {; footerName ; footerVar} )  
Parameter Type   Description
Operator in If specified, object is an object name (string) If omitted, object is a variable
object  Form object in Object name (if * is specified) or Variable (if * is omitted) of the column to be duplicated
colPosition  Longint in Location of new duplicated column
colName  String in Name of new column
colVariable  Array, Field, Variable in Name of the column array variable or field or variable
headerName  String in Column header object name
headerVar  Integer variable in Column header variable
footerName  String in Column footer object name
footerVar  Variable in Column footer variable

The LISTBOX DUPLICATE COLUMN command duplicates the column designated by the object and * parameters by programming in the context of the form being executed (Application mode). The original form, generated in the Design mode, is not modified. 

Note: This functionality was already found in 4D, in Design mode only, using the Duplicate Column command found in the context menu of the Form editor.

By default, all style options (size, color, formats, etc.) set for the source column by means of the Property list or using object management commands (OBJECT SET COLOR, etc.) are applied to the copy. The object method and the settings of the form events are also duplicated.
However, the data source (array or selection, depending on the source type set for the list box) as well as the style and color arrays are not duplicated. It is your responsibility to define them for each new column after duplication. 

The object and * parameters designate the column to duplicate. Passing the optional * parameter indicates that the object parameter is an column name (string). If you do not pass this parameter, it indicates that the object parameter is a column variable. In this case, you pass a variable reference instead of a string.

Note: This command does nothing when it is applied to the first column of a list box displayed in hierarchical mode.

The new duplicated column is placed just before the column designated by the colPosition parameter. If the colPosition parameter is greater than the total number of columns, then the duplicated column is placed after the last column.

In the colName and colVariable parameters, pass the object name and the variable of the new duplicated column.

  • For array type list boxes, the variable name corresponds to the name of the array whose contents will be displayed in the column.
  • For selection type list boxes, you can pass a field or variable in the colVariable parameter. So the contents of the column will be the value of this field or variable, evaluated for each record of the selection associated with the list box. This type of content can only be used when the "Data Source" property of the list box is set to Current Selection or Named Selection.

Remember that the data source of the original column is not duplicated: you must set a source variable, array or field for the new duplicated column.

In the headerName and headerVariable parameters, pass the object name and variable for the header of the new duplicated column. You can also pass the object name and variable for the footer of the inserted column in the footerName and footerVariable parameters. If you omit the footerVariable parameter, 4D uses a dynamic variable.

Note: Object names must be unique in a form. You must make sure that the names passed in the colName, headerName and footerName parameters have not already been used. Otherwise, the column is not duplicated and an error is generated. 

This command must be used in the context of displaying a form. It is usually called in the On Load form event or following a user action (On Clicked event).

Example  

In an array type list box, we want to duplicate the "First Name" column, ready for input:

Here is the code of the button:

 ARRAY TEXT(arrFirstNames2;Records in table([Members]))
 LISTBOX DUPLICATE COLUMN(*;"column2";3;"col2bis";arrFirstNames2;"FirstNameA";vHead2A)
 OBJECT SET TITLE(*;"FirstNameA";"Middle Name")
 EDIT ITEM(*;"col2A";0)

When you click on the button, the list box appears as follows:

 
PROPERTIES 

Product: 4D
Theme: List Box
Number: 1273

 
HISTORY 

New
Created: 4D v14

 
SEE ALSO 

LISTBOX MOVE COLUMN

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14.3)

Parent of : LISTBOX DUPLICATE COLUMN ( 4D v14 R3)