Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
VCL
Win 32 Controls
TAnimate
TComboBoxEx
TCoolBar
TDateTimePicker
THeaderControl
THotKey
TImageList
TListView
TMonthCalendar
TPageControl
TPageScroller
TProgressBar
TRichEdit
TStatusBar
TTabControl
TToolBar
TTrackBar
TTreeView
TUpDown
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/VCL/Win 32 Controls/TListView
[ Add a report in this area ]
Report #:
85130
Status:
Closed
Several TListView properties has wrong values
Project:
Delphi
Build #:
14.0.3593.25826
Version:
14.0
Submitted By:
Hans Christoffersen
Report Type:
Issue
Date Reported:
6/4/2010 5:21:38 AM
Severity:
Serious / Highly visible problem
Last Updated:
4/23/2013 8:18:01 AM
Platform:
All platforms
Internal Tracking #:
277618
Resolution:
Duplicate
(Resolution Comments)
Resolved in Build:
:
XE4
Duplicate of:
87943
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
When TListView.ViewStyle <> vsIcon, the following properties has wrong values when accessed from TForm.Create:
Items.Count : 0
This was not an issue in Delphi 2009
----------
The following properties has always wrong values:
TListView.VisibleRowCount
This was not an issue in Delphi 2009
Added by Sysop
<<<<<<<<<<<<<<<<<<<<
I think this issue is due to lazy initialization to increase speed. So, we need to access Handle property before reading Items.Count property as below.
-------------
procedure TForm1.FormCreate(Sender: TObject);
begin
ListView1.Handle; // <<--- to avoid lazy initialization
ShowMessage(IntToStr(ListView1.Items.Count));
end;
-------------
>>>>>>>>>>>>>>>>>>>>
Steps to Reproduce:
1) Create a new VCL Forms Application
2) Place a TListView on the form
3) Add some items to the ListView
4) Change ViewStyle to vsReport, vsList or vsSmallIcon
5) Access Items.Count from TForm.Create
6) Property Count will have a value of 0
----------
1) Create a new VCL Forms Application
2) Place a TListView on the form
3) Add some items to the ListView
4) Access VisibleRowCount
5) Property VisibleRowCount will have a wrong value
Workarounds
When TListView.ViewStyle <> vsIcon, Items.Count has a value of 0 when accessed from TForm.Create:
Access Items.Count from TForm.Show
----------
VisibleRowCount has always a wrong value:
None
Attachment
None
Comments
Tomohiro Takahashi at 6/8/2010 10:42:59 PM
-
> 6) Property Count will have a value of 0
I think your issue is due to lazy initialization to increase speed.
So, please try to access Handle property before reading Items.Count property as below.
-------------
procedure TForm1.FormCreate(Sender: TObject);
begin
ListView1.Handle; // <<--- to avoid lazy initialization
ShowMessage(IntToStr(ListView1.Items.Count));
end;
-------------
Hans Christoffersen at 6/24/2010 2:07:47 AM
-
Seems to work
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us