Solved

TListView Problem..

Posted on 1998-08-31
4
150 Views
Last Modified: 2010-04-04
Problem is that it pushed url to 2th line whatever i try..

Procedure TMainForm.DisplayFileList;
Var  NewItem : TListItems;  I : LongInt;
Begin
  NewItem := FilesLV.Items;

  FilesLV.Columns.Add.Caption := 'FileName';
  FilesLV.Columns.Add.Caption := 'URL';
  FilesLV.Columns.Add.Caption := 'Desc';
  FilesLV.Columns.Add.Caption := 'Size Kb';
 for I := 0 to TItems_Count-1 do
  Begin
   NewItem.Add.Caption := TItems[I].FileName;
   // Need to add  TItems[i].URL;
   // Need to add  TItems[i].Desc;
End;End;

0
Comment
Question by:brainware
  • 3
4 Comments
 
LVL 4

Accepted Solution

by:
itamar earned 30 total points
ID: 1338293
Hi brainware,

it's me again !

It seems that your trying to make a columned list, right ?

Well, in this case only the "caption" property refers to the first column of an item.
For the others column you have to add subitems of the NewItem added.

To set the columns headers, use the Object Inspector in the Columns... property.

IHTH
0
 
LVL 2

Author Comment

by:brainware
ID: 1338294
Could u be kind and show me that as code.. im not 100% good at english :)
0
 
LVL 4

Expert Comment

by:itamar
ID: 1338295
Ok brainware,

just give me sometime. I´m a little busy right now...
0
 
LVL 4

Expert Comment

by:itamar
ID: 1338296
Hi brainware,

as promised, this is an example:


procedure TForm1.Button1Click(Sender: TObject);
var
  NewItem: TListItem;
begin
  NewItem := ListView1.Items.Add;
  NewItem.Caption := 'your file name';
  NewItem.SubItems.Add('your url');
  NewItem.SubItems.Add('your description');
  NewItem.SubItems.Add('your file size');
end;

Don´t forget to set the columns in the Object inspector (Columns property).
It´s not necessary to do it in the code.

Any doubts place a question with the subject "To: Itamar"

IHTH
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 198
delphi prevent click fast 2 168
Delphi Form ownership 4 54
Run video youtube webbrowse 10 45
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now