Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617

    listbox problems!!!

    alright, where am i going wrong? i have a listbox that is populated with the lua files in the script folder. when i double-click i want that lua file to load. its not working. any ideas?

    Code:
    atbFiles = File.Find(_SourceFolder.."\\AutoPlay\\Scripts", "*.lua", false, false, nil,nil);
    if atbFiles then
    	for i,v in atbFiles do
    		ListBox.AddItem("ListBox1", String.SplitPath(v).Filename, v);
    	end
    end
    and this is the double-click ( i also but this same code on the button, on-click)
    Code:
    atbSelected = ListBox.GetSelected("ListBox1");
    if atbSelected then
    	astrScript = ListBox.GetItemData("ListBox1", atbSelected);
    	Application.LoadScript(astrScript);
    end
    another question... how can i make changes to one of the questions and have it save the changes back to the LUA file?

    thanks for any suggestions on the second question. i've been looking for an answer for that one but just cant figure out a salution.


    chris
    Attached Files

  2. #2
    Join Date
    Oct 2005
    Location
    Brazil - Belo Horizonte
    Posts
    118
    atbFiles = File.Find(_SourceFolder.."\\AutoPlay\\Scripts", "*.lua", false, false, nil,nil);
    if atbFiles then
    for i,v in atbFiles do
    ListBox.AddItem("ListBox1", String.SplitPath(v).Filename, v);
    end
    end

    atbFiles refers to the File.Find action that returns a table. You just typed in the name of the variable that refers to the action File.Find. When there's an action that returns a table you have to type in the name of the variable . key.
    Example:
    result = File.Find("C:\\MyDir\\", "*.pdf", false, false, nil, nil);
    After this line you can't just type in "result". you have to type in result.Folder or result.Filename or any other key from the table that the action File.Find returns.
    This is what File.Find returns:
    (table)
    KEY_______________________TYPE
    Folder_____________________string
    Filename___________________string
    Recurse___________________booblean
    IncludeFolders______________booblean
    CallbackFunction____________function
    FileFoundCallbackFunction____function
    I hope that helps. Good luck!

  3. #3
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617
    alright! here is what i had...
    Code:
    atbSelected = ListBox.GetSelected("ListBox1");
    if atbSelected then
    	astrScript = ListBox.GetItemData("ListBox1", atbSelected);
    	Application.LoadScript(astrScript);
    end
    and this is what fixed it.
    Code:
    atbSelected = ListBox.GetSelected(this);
    if atbSelected then
    	astrScript = ListBox.GetItemData(this, atbSelected[1]);
    	Application.LoadScript(astrScript);
    end
    this is the code used under the double-click

    chris

Similar Threads

  1. Listbox disappearing question
    By ebrusher in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 07-09-2005, 06:38 AM
  2. ListBox woes
    By baddavid in forum AutoPlay Media Studio 4.0
    Replies: 1
    Last Post: 07-30-2004, 01:57 AM
  3. Example: Using the ListBox object
    By Ted Sullivan in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-07-2004, 12:24 PM
  4. Listbox... how to? part 2
    By cold_fusion in forum AutoPlay Media Studio 4.0
    Replies: 7
    Last Post: 02-07-2004, 12:28 PM
  5. From listbox to listbox to flash
    By Konradsen in forum AutoPlay Media Studio 4.0
    Replies: 5
    Last Post: 05-13-2003, 06:24 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