The Delphi Bug List

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/AAbsentAbsentAbsentAbsentExistsExistsExistsExistsExistsExistsExistsExistsExistsN/A
Description
Reported by Steve Gardner; checked by Reinier Sterkenburg
To reproduce:
  1. 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.
  2. Put a TLabel on the form and give the form an OnCreate handler containing the following line:
      Label1.Caption := IntToStr(ListView1.Items.Count);
  3. 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;
Latest update of this entry: 2002-04-03

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.