Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    49

    getting items into a list box

    Hi guys

    I wonder if any of you can help with this problem.
    I wish to import a list of directories from an external drive (F into a list box, allowing a user then to choose the one they require. As these are specific directories they all have an underscore in them.
    So far I have been able to get the directories to show as a list in a dialogue.message, but am stuck getting them into a listbox.
    My script so far is:-

    -- Set the drive to search
    drive = "F:\\";
    -- Set the folder to search for
    folder = "*_*";
    -- Search the specified drive for folders inlcuding an "_"

    search_results = Folder.Find(drive, folder, false, FindCallBack);

    --Check to see if an error occurred during the search. If it did, display the error message.error = Application.GetLastError();

    if error ~= 0 then
    Dialog.Message("Error",_tblErrorMessages[error]);
    else
    -- If no directories were found, inform the user if (search_results == nil) then
    Dialog.Message("Attention", " No Compatible directories found.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    Application.Exit(0);
    else
    -- If folders were found, display a dialog containing a list of their locations.

    message = "Folders have been found as detailed below \r\nPlease select the one you require\r\n";
    for index, path in search_results do
    message = String.Concat(message, path.."\r\n");
    MessDelete = Dialog.Message("Attention", message, MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    end

    What I now need to do is replace the red message with a listbox

    Any ideas guys

    Thanks

  2. #2
    Join Date
    Aug 2003
    Posts
    2,427
    Assuming you've got a list box on your page then -

    drive = "C:\\";
    folder = "*";

    search_results = Folder.Find(drive, folder, false, Nil);

    if (search_results) then
    for index, path in search_results do
    split_path = String.SplitPath(search_results[index]);
    folder_name=split_path.Filename
    result = ListBox.AddItem("ListBox1", folder_name, search_results[index]);
    end
    end

    should work OK.
    Last edited by longedge; 01-31-2007 at 08:56 AM. Reason: Quote tags do something funny - turn a backslash into a weird Y

  3. #3
    Join Date
    Jan 2007
    Posts
    49

    Creating Listbox

    Thanks Longedge

    It works a treat - I've just upgraded from version 4 after having bought a licenced 5 over a year ago, but decided at last to take the plunge and try and get my head round some of these scripts in 5. My current project is quite involved, and I needed to use features that V4 couldn't do.

    Hopefully with perseverance and some help from you veterans (please don't take that as age related) I'll master it !

    Many thanks again

Similar Threads

  1. List Box problem
    By TonyTJ in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 02-25-2006, 07:22 AM
  2. List Box Object Frustration
    By Firenegn in forum AutoPlay Media Studio 4.0
    Replies: 11
    Last Post: 10-04-2004, 05:53 PM
  3. List box suggestions/help Can you advise ?
    By jimmy guilfoyle in forum AutoPlay Media Studio 4.0
    Replies: 3
    Last Post: 05-22-2004, 12:07 PM
  4. HOWTO: Set up an MP3 Playlist
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-24-2002, 11:57 AM
  5. HOWTO: Display Conditional Text Based Upon a List Box Selection
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-15-2002, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts