Solved

TListView Problem..

Posted on 1998-08-31
4
158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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