Solved

Getting ListView to work.

Posted on 1998-07-30
1
149 Views
Last Modified: 2010-04-04
Could someone please post an example of how to get the ListView component to work. I have it setup for a report view with 2 columns. I just can't seem to get it too add items and sub items. I'm using version 3.0.
Thanks
0
Comment
Question by:LostOne
1 Comment
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 100 total points
ID: 1359289
Hi

Have you set up your listview's columns?  This is an example which adds 2 columns, then some data to a listview.  (My listview is called lvTest.)

  // Set the view style.
  lvTest.ViewStyle := vsReport;

  // Add some columns.
  with lvTest.Columns.Add do
    begin
      Caption := 'First Column';
      Width := 100;
    end;
  with lvTest.Columns.Add do
    begin
      Caption := 'Second Column';
      Width := 100;
    end;

  // Add some items.
  with lvTest.Items.Add do
    begin
      Caption := 'First Caption';
      SubItems.Add('This is in 2nd col.');
    end;
  with lvTest.Items.Add do
    begin
      Caption := 'Second Caption';
      SubItems.Add('This is in 2nd col.');
    end;

Cheers,
JB
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 81
Making delphi communicate with a c# service 16 111
How to build JSON File in Delphi 6 3 45
Delphi: sending SMS on android platform 1 34
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question