?
Solved

How to Put NMFTP DirectoryList Items Inside a LIStView Control

Posted on 2002-07-02
8
Medium Priority
?
1,074 Views
Last Modified: 2012-05-04
Hi there,

How can I put the values of NMFTP Directory List inside a Listview Control?

I Was able to put NMFTP Directory List Values in a listbox but the thing is, I have to parse it to get specific information like, date, attributes, size, filename, etc.

I kNow NMFTP Directory list passes the values as a string parameter when the List Method is invoked but how do you get the attribute, name, size, etc from the string parameter?

I tried testing this to get the attribute of a certain file on the list but:

showmessage(NMFTP1.FtpDirectOryList.Attribute.Text);

but it returns a blank box.

Any help would be greatly appreciated.
0
Comment
Question by:lapuk
8 Comments
 
LVL 7

Expert Comment

by:Cynna
ID: 7125050
lapuk,

> showmessage(NMFTP1.FtpDirectOryList.Attribute.Text);

should be:

showmessage(NMFTP1.FTPDirectoryList.Attribute.Strings[index]);

(for example, index=0, will get you attribute string of first file)

Few remarks:

1. Using List method does not guarantee you to parse atribute, name, size... correctly. This depends on directory listings formatting of the FTP server you are connecting to. If this happens, probably the best would be setting ParseList to false and then using the OnListItem event to do your own manual parsing.

2. NM... (NetMasters) components are known to be quite buggy. I'd advise you to forget them all together, and use third party components (like ICS or Indy).
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7125647
> 1. Using List method does not guarantee you to parse atribute, name, size... correctly.  
that's so true !! in fact in my testing it didn't parse a single site correctly !!!

as Cynna I suggest you to use Indy from www.nevrona.com/indy
0
 

Author Comment

by:lapuk
ID: 7125875
I tried this :
showmessage(NMFTP1.FTPDirectoryList.Attribute.Strings[index]);

but it gives me an out of bounds error, I just wonder why when in fact it was able to list the values inside a listbox..
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Accepted Solution

by:
Cynna earned 200 total points
ID: 7126494
lapuk,

Here's comlete example that works (most of the time: read my remark #2 in previous post, and then read it again).
Initially Copy/Paste it, to see if it works for your local/remote system:

(place Button and NMFTP on the form)

procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
begin
  NMFTP1.ParseList := True;
  NMFTP1.Vendor := NMOS_AUTO;
  NMFTP1.Connect;
  while not NMFTP1.Connected do begin
     Application.ProcessMessages;
     Sleep(1);
  end;
  Memo1.Lines.Clear;
  Memo1.Lines.Add('Connected');
  NMFTP1.List;
  for i := 0 to NMFTP1.FTPDirectoryList.Name.Count - 1 do
      Memo1.Lines.Add(Format('File: %s, Size: %s, Date: %s, Attr: %s', [
                     NMFTP1.FTPDirectoryList.Name[i],
                     NMFTP1.FTPDirectoryList.Size[i],
                     NMFTP1.FTPDirectoryList.ModifDate[i],
                     NMFTP1.FTPDirectoryList.Attribute[i]]));
  NMFTP1.Disconnect;
end;
0
 

Expert Comment

by:CleanupPing
ID: 9343119
lapuk:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 

Author Comment

by:lapuk
ID: 9345235
Hi sorry all, it took me quite a while to respond to this, thanks to everyone who excerted the effort in finding a solution to my problem. Although this question has been raised a long time ago, and fortunately, I found my own way of solving it.

My solution is almost the same as that of Cynna, although a used Tstringlist instead. My FTP server returns a directory list but all attributes are in a single line, so I have to make a parseing routine to be able to assign specific attributes for each record.

So I am accepting Cynnas Answer instead. :-)

Thanks everyone.
0
 

Author Comment

by:lapuk
ID: 9345251
Hmm.. weird.. I am trying to accept cynnas answer but it gives me this message..

 " You cannot accept this answer.. " hmnn.. kinda weird.
0
 

Author Comment

by:lapuk
ID: 9345256
oh.. ok.. now its updated :-)

Thanks all!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

850 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