IListView.InsertControl

Syntax

InsertControl(Control: IControl; Column: Integer; Row: Integer);

Parameters

Control. The component that must be inserted into component elements area.

Column. Index of the column, to which a component must be inserted.

Row. Index of the row, to which a component must be inserted.

Description

The InsertControl method inserts a component in the area of elements of the ListView component.

Comments

This method can be used if the Style property is set to ListViewStyle.Report.

NOTE. The height of inserted component will match height of elements of the ListView component. The width of inserted component will match the width of corresponding column.

The inserted component is a child for the ListView component. The created components can be accessed using the IComponent.Components property. To delete the created component, use the IFormControl.FreeComponent method.

Example

Executing the example requires a form, the Button1 button on the form, and the ListView component named ListView1. Two columns and several elements are created for ListView1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    c: ICheckBox;
    i: Integer;
Begin
    ListView1.Style := ListViewStyle.Report;
    
For i := 0 To ListView1.Items.Count - 1 Do
        c := New CheckBox.Create;
        c.Name := c.Name + i.ToString;
        c.Text := 
"Parameter " + i.ToString;
        ListView1.InsertControl(c, 
1, i);
    
End For;
    ListView1.ItemHeight := 
16;
End Sub Button1OnClick;

Clicking the button inserts radio buttons to the second column of the ListView1 component. The element height is set to 16.

See also:

IListView