Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 33
  1. #1
    Join Date
    Dec 2003
    Posts
    891

    List box questions

    Is there a way to limit the number of rows the list box will except? Like 6 from a user input object?
    When pulling the info (text/data fields) out of the list box, is there a way to get it all at once instead of having to read each line number at a time (2 times actually as the text and data fields come out seperately).

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hi. You can easily use actions to limit the contents of a listbox. Getting your data into a table and then using a "for" loop (check help file) to move through the data is easier than evaluating it manually one piece at a time.

  3. #3
    Join Date
    Dec 2003
    Posts
    891

    feel silly

    easy enough to limit list box entries, just needed to think.
    getting the info out of the box and into a table little harder.
    can some one give me a quick example?
    Here is apz. I have everything else finished, but need to put list box entries (3) into a table.
    Attached Files
    Last edited by Roboblue; 08-08-2005 at 05:17 PM.

  4. #4
    Join Date
    Dec 2003
    Posts
    891

    whoops

    here is apz without needing popup plugin
    Attached Files

  5. #5
    Join Date
    May 2001
    Location
    51.531249 | -0.610962
    Posts
    1,244
    Hi

    You can use ListBox.GetCount to control the number of items. Something like this will work.
    Of course you may want to add an IF to check that the input object does actually contain text.

    Code:
    num_items = ListBox.GetCount("ListBox1");
    if num_items < 6 then
    	sInput_Text = Input.GetText("Input1");
    	ListBox.AddItem("ListBox1", sInput_Text);
    else
    	Dialog.Message("Notice", "You can not have more than six items.");
    end
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

  6. #6
    Join Date
    May 2001
    Location
    51.531249 | -0.610962
    Posts
    1,244
    oops! - i forgot the table bit.

    I threw this together, so there may be a shorter way, but this will work

    Code:
    -- get the number of items in listbox
    num_items = ListBox.GetCount("ListBox1");
    
    counting = 1 -- set the first index number
    min = 1;  -- The number to start at
    max = num_items;  -- The number to stop at .. in this case, whatever the listbox holds (6?) 
    for count = min, max do
    	-- get the item text .. use 'counting' as number 1
    	sItem_Text = ListBox.GetItemText("ListBox1", counting);
    	-- insert the text into table at position 'counting' .. which = 1
    	Table.Insert(my_table, counting, sItem_Text);
    	-- increase 'counting' by 1 so it becomes 2, 3, 4 etc as we loop thru this
    	counting = counting+1
    end
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

  7. #7
    Join Date
    Dec 2003
    Posts
    891
    Thanx Derek
    I am going to work on this now.

  8. #8
    Join Date
    May 2001
    Location
    51.531249 | -0.610962
    Posts
    1,244
    You're welcome
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

  9. #9
    Join Date
    Dec 2003
    Posts
    891

    error

    Derek
    I am getting a "argument 1 must be table type" for the insert table line 14

    -- get the number of items in listbox
    num_items = ListBox.GetCount("Link_lst");

    counting = 1 -- set the first index number
    min = 1; -- The number to start at
    max = num_items; -- The number to stop at .. in this case, whatever the listbox holds
    for count = min, max do
    -- get the item text .. use 'counting' as number 1
    sItem_Text = ListBox.GetItemText("Link_lst", counting);
    ---check what's in sItem_Text
    result = Dialog.Message("Notice", sItem_Text, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

    -- insert the text into table at position 'counting' .. which = 1
    Table.Insert(my_table, counting, sItem_Text);
    -- increase 'counting' by 1 so it becomes 2, 3, 4 etc as we loop thru this
    counting = counting+1
    end
    TextFile.WriteFromTable("AutoPlay\\Docs\\links.txt ", my_table, true);
    File.Open("AutoPlay\\Docs\\links.txt", "", SW_SHOWNORMAL);

    Also, this is just getting the list box item text. also want the data. The purpose is to populate a table to feed the popup menu plugin, user entered url links. In this code, I will end up with 2 tables that will have to be dumped into variables for the popup menu.

  10. #10
    Join Date
    Dec 2003
    Posts
    891

    apz

    here is apz with the above code to show object reference.
    check the table list button actions
    Attached Files

  11. #11
    Join Date
    May 2001
    Location
    51.531249 | -0.610962
    Posts
    1,244
    Hi Roboblue

    Line 14 refers to table "my_table" which needs to exist in order to insert items into it [computers can be real fussy at times!].
    You'll need to create "my_table" before you run the script to insert the items.

    As for the item.data - you should be able to use similar script to what you already have for item.text. Just change it to suit your needs
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

  12. #12
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    add this line in before your for statement Robo

    Code:
    --create the table
    my_table = {}
    for count = min, max do

  13. #13
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Here's a hack on Derek's code...
    Replace the code in your Table List button with this

    Code:
    -- get the number of items in listbox
    num_items = ListBox.GetCount("Link_lst");
    
    min = 1;  -- The number to start at
    max = num_items;  -- The number to stop at .. in this case, whatever the listbox holds (6?) 
    my_table={}
    for count = min, max do
    	-- get the item text .. use 'counting' as number 1
    	sItem_Text = ListBox.GetItemText("Link_lst", count);
    	sItem_Data = ListBox.GetItemData("Link_lst", count);
    	---check what's in sItem_Text
    	result = Dialog.Message("Notice", "List Text:  "..sItem_Text.."\r\nList Data:  "..sItem_Data, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    
    	-- insert the text into table at position 'counting' .. which = 1
    	my_table[count]= {Name=sItem_Text, Link=sItem_Data};
    end
    
    tblPopUp = {}
    for count = 1, Table.Count(my_table) do
    	tblPopUp[count] = {text=my_table[count].Name, type=0,checked=false,enabled=true}
    end
    
    sSelected = PopupMenu.Show(tblPopUp, 0, 0, PopupMenu.HALIGN_LEFT,PopupMenu.VALIGN_TOP);
    for count = 1, Table.Count(my_table) do
    	if my_table[count].Name == sSelected then
    		File.OpenURL(my_table[count].Link, SW_SHOWNORMAL)
    		count = Table.Count(my_table)
    	end
    end

  14. #14
    Join Date
    Dec 2003
    Posts
    891

    thanx guys

    I forgot about having to create the table first.
    I was just working on using a table to populate the popup menu and wasn't even close with that. I am so rusty, and considering that I have never been greatly versed or experienced as a programmer anyway, I was struggling.

  15. #15
    Join Date
    Dec 2003
    Posts
    891

    changes

    I decided since I have the sqlite plugin that I would use a db instead of a table so I could use the popup menu on any page and project.
    Can some one PLEASE tell me why the delete button will not work. I thought I knew a little about sqlite.
    Attached Files

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. List Box Object Frustration
    By Firenegn in forum AutoPlay Media Studio 4.0
    Replies: 11
    Last Post: 10-04-2004, 05:53 PM
  2. 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
  3. dynamic list box, part 2
    By intel352 in forum Setup Factory 6.0
    Replies: 10
    Last Post: 01-27-2003, 10:33 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