Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    891

    Help with tables

    Could someone please tell me why there is a space in the list box?
    The table is being created from a folder of text files.
    The pipe(|) is required as a separator in Xdialog popup list box.
    Here is a pic of the list box. Note that there is a space between entries. These will cause an error when selected as there is no data there.
    I have been fooling with this for hours, so I think I am just too close to it and am missing something simple.
    Code:
    tItems = File.Find("AutoPlay\\Docs\\txt\\recipes", "*", false, false, nil);
    tText = {};
    --do the following for each file:
    	for j,file_path in tItems do
        tSplit = String.SplitPath(file_path);
        sSplit = String.Concat(tSplit.Filename, "|");
       	Table.Insert(tText, Table.Count(tText) + 1, sSplit);
       	end
    	sItems = Table.Concat(tText, "|", 1, TABLE_ALL)
    -- Show the listbox and pass it the list of items to display
    Item = xDialog.Show_ListBox("Please choose an item", sItems, 325, 375)
    -- If an item was selected, then add it to the input field.
    if Item ~= "CANCEL" then
    Input.SetText("Input1", Item)
    tFile = File.Find(_SourceFolder.. "\\AutoPlay\\Docs\\txt\\recipes", ""..Item..".txt", false, false, nil, nil);
    sFile = TextFile.ReadToString(tFile[1]);
    Paragraph.SetText("Paragraph1", sFile);
    end
    Attached Images

  2. #2
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    You are adding the pipe(|) twice. Try this

    Code:
    tItems = File.Find("AutoPlay\\Docs\\txt\\recipes", "*", false, false, nil);
    tText = {};
    --do the following for each file:
        for j,file_path in tItems do
            tSplit = String.SplitPath(file_path);
            sSplit = tSplit.Filename;
            Table.Insert(tText, Table.Count(tText) + 1, sSplit);
       end
        sItems = Table.Concat(tText, "|", 1, TABLE_ALL)
    -- Show the listbox and pass it the list of items to display
    Item = xDialog.Show_ListBox("Please choose an item", sItems, 325, 375)
    -- If an item was selected, then add it to the input field.
    if Item ~= "CANCEL" then
    Input.SetText("Input1", Item)
    tFile = File.Find(_SourceFolder.. "\\AutoPlay\\Docs\\txt\\recipes", ""..Item..".txt", false, false, nil, nil);
    sFile = TextFile.ReadToString(tFile[1]);
    Paragraph.SetText("Paragraph1", sFile);
    end
    Dermot

    I am so out of here

  3. #3
    Join Date
    Dec 2003
    Posts
    891
    Thanx Dermot, that was it.

Similar Threads

  1. Replies: 11
    Last Post: 06-29-2005, 01:36 PM
  2. Tables, CSV (Excel) and Database Reports
    By csd214 in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 04-27-2004, 12:08 PM
  3. Using Tables and Memory resources handling
    By SUF6NEWBIE in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 04-19-2004, 12:11 PM
  4. Always confusing with tables
    By arnaud in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 01-25-2004, 06:33 PM
  5. Working with Tables and Files
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 12-23-2003, 08:22 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