ftp problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • TristanD
    Forum Member
    • Oct 2006
    • 314

    ftp problem

    hi, i;ve got a little problem.. can someone tell me why the name of the file/folder does not get set as the data in the LB?

    Code:
    ftp_dir_index = FTP.List();
    
    -- add each item to the listbox in this format:
    -- <name> (<size>)
    for i = 1, ftp_dir_index.Count do
        local name = ftp_dir_index[i].Name;
        local size = ftp_dir_index[i].Size;
        local date = ftp_dir_index[i].Date;
    	ftp_file_info = FTP.GetFileInfo(name);
    	
        if ftp_dir_index[i].Type == FTP.FOLDER then
            -- add a [ ] prefix to make the folders stand out in the listbox
            ListBox.AddItem("ftp_dir_index", "[ FOLDER ]  "..name.."      ("..size.." bytes) ", name);
    
        else
            ListBox.AddItem("ftp_dir_index", "[  FILE  ]  "..name.."      ("..size.." bytes) ", name);
        end
        ListBox.SetUpdate("ftp_dir_index", true);
    end
  • Tek
    Forum Member
    • Mar 2004
    • 695

    #2
    Hmm well it seems to be working for me on the FTP site I tested with.

    Try adding this to your 'On Select' actions for the listbox. It will tell you the data field when you click on it. Again, it appears to work for me. Not sure if it's a problem with your connection to the FTP server since I'm assuming you can see the listbox being populated, right?

    Code:
    tSelected = ListBox.GetSelected("ftp_dir_index");
    for index in tSelected do
    	Dialog.Message("Listbox Data Field", ListBox.GetItemData("ftp_dir_index", tSelected[index]), MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end

    Comment

    • TristanD
      Forum Member
      • Oct 2006
      • 314

      #3
      Originally posted by Tek View Post
      Not sure if it's a problem with your connection to the FTP server since I'm assuming you can see the listbox being populated, right?
      [/code]
      yeah it does get populated.. i've made the listbox change the text of a label to the itemdata on double click and it went blank.. your little solution worked

      thanks, Tristan

      Comment

      Working...
      X