Entry No.
617
|
VCL - Win32 - ComCtrls - TListView
The Items property of a read-only TListView does not contain the
values loaded from the form file until some point after the owning
form's OnCreate event.
|
|
| 1.02 |
2.01 |
3.0 |
3.01 |
3.02 |
4.0 |
4.01 |
4.02 |
4.03 |
5.0 |
5.01 |
6.0 |
6.01 |
6.02 |
Kylix 1.0 |
| N/A | Absent | Absent | Absent | Absent | Exists | Exists | Exists | Exists | Exists | Exists | Exists | Exists | Exists | N/A |
|
|
|
Description | |
Reported by Steve Gardner; checked by Reinier Sterkenburg
To reproduce:
- Put a TListView on a form, and set its ReadOnly property to True.
Right-click the TListView and, using the Items Editor, give it
some items.
- Put a TLabel on the form and give the form an OnCreate handler
containing the following line:
Label1.Caption := IntToStr(ListView1.Items.Count);
- Run the project. The label will show a zero.
|
|
|
Solution / workaround | |
At the start of the form's OnCreate handler, insert the line:
ListView1.Items.Add.Delete;
|
|