Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2006
    Posts
    13

    Listbox from listbox

    Hi, I know it should be simple, but I can't figure it out.

    I would like to add a selection of items from listbox1 to listbox2.

    Listbox1 has 90 items listed in and I need to index the 20 items located between lines 20 to 40 in a second listbox (listbox2).

    Could anyone help me with this?

    Idiogene

  2. #2
    Join Date
    Oct 2006
    Posts
    13

    Smile

    Ok, after many try I found a way.
    -----
    function list1tolist2()
    count = 19;
    repeat
    count = count + 1;
    resultD = ListBox.GetItemData("listbox1", count);
    resultT = ListBox.GetItemText("listbox1", count);
    ListBox.AddItem("listbox2", resultT, resultD);
    until count 40
    end
    ----
    It might not be the best way but at least it works

    Thank's

    Idiogene

  3. #3
    Join Date
    May 2006
    Posts
    5,380
    yes, it works and theres nothing wrong with it

    this just makes it a little more *dynamic*

    Code:
    function list1tolist2(strOBJ1,strOBJ2)
    	local nCount = ListBox.GetCount(strOBJ1);
    	for index = 1, nCount do
    		local resultD = ListBox.GetItemData(strOBJ1, index);
    		local resultT = ListBox.GetItemText(strOBJ1, index);
    		ListBox.AddItem(strOBJ2, resultT, resultD);
    	end
    end
    
    -- Test
    list1tolist2("listbox1","listbox2")
    Open your eyes to Narcissism, Don't let her destroy your life!!

  4. #4
    Join Date
    Oct 2006
    Posts
    13
    I see said the blind man.
    That's what I was looking for and didn't know how to ask for.
    .. it's much more *dynamic*.
    Thank you,

    Idiogene

  5. #5
    Join Date
    May 2006
    Posts
    5,380
    lol, no problem

    i just read you 1st post properly, i dident see the > 20 and < 40 thing i just looked at your function

    add the bits in red to only add items 20 to 40
    Code:
    function list1tolist2(strOBJ1,strOBJ2)
    	local nCount = ListBox.GetCount(strOBJ1);
    	for index = 1, nCount do
    		if index > 20 and index < 40 then
    			local resultD = ListBox.GetItemData(strOBJ1, index);
    			local resultT = ListBox.GetItemText(strOBJ1, index);
    			ListBox.AddItem(strOBJ2, resultT, resultD);
    		end
    	end
    end
    
    list1tolist2("ListBox1","ListBox2")
    Last edited by RizlaUK; 04-30-2008 at 07:07 PM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  6. #6
    Join Date
    Oct 2006
    Posts
    13
    Tested... Yes! It works wonderfully.
    Again, thank you very much RizlaUK for this lesson of syntax.

    Idigene

Similar Threads

  1. ListBox indexing explained
    By Adam in forum AutoPlay Media Studio 7.5 FAQ
    Replies: 0
    Last Post: 11-01-2007, 01:58 PM
  2. ListBox - How to autoscroll?
    By azmanar in forum AutoPlay Media Studio 6.0
    Replies: 6
    Last Post: 01-17-2007, 07:09 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