Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2003
    Posts
    29

    I need help with paragraph and listbox

    First sorry fot my english, I try to explain as well as I can.

    I´m doing a project with various albums and I want to see the cover of the album and a little description below the cover. I change between albums with the listbox and with a button a load the mp3(or m3u)

    I have everything except the paragraph, I don´t know how to make to show a little description in the paragraph for each album.


    thank in advance
    Attached Images
    Attached Files

  2. #2
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    This can be done a similar way to a recent post I placed here. There are certainly other ways. Here are the modifications I made in your project:

    In the ListBox dialog, you are setting just the image file name. I suggest that you set there as well the text you want to display, or the filename of the text you want to show in the Paragraph object.

    So, instead of just setting "pic1.jpg" as Item Data, set it as "pic1.jpg|This is the text for the first option", for example.



    Then, using Lua, split the information appart and use them in the Image and Paragraph:

    Code:
    tSelected = ListBox.GetSelected("ListBox1");
    if tSelected then
        sFile = ListBox.GetItemData("ListBox1", tSelected[1]);
        -- split the text of the Item Data: separate the image name and paragraph text (or file name, see below)
    
        separator = String.Find(sFile, "|");
        image = String.Mid(sFile, 1, separator-1);
        text = String.Mid(sFile, separator+1, -1);
    
        -- Load filename into Image object
        Image.Load("Image1", "AutoPlay\\Images\\" .. image);
    
        -- set the text of the paragraph object 
        Paragraph.SetText("Paragraph1", text);
    	
        -- if the text should be a filename instead, just modify accordingly,
        -- using something like this (modify to fit your needs):
        -- textfile = TextFile.ReadToString("AutoPlay\\Docs\\" .. text);
        -- Paragraph.SetText("Paragraph1", textfile);
    end
    Ulrich
    Last edited by Ulrich; 08-21-2008 at 07:57 AM.

  3. #3
    Join Date
    Jul 2003
    Posts
    29
    ok, thanks a lot upeters. I try to do this solution with the "pipe" but I didn´t resolve it.

    I add the lines for open the mp3 or m3u with the button "open", while you see the cover and the description of the album.

    thank you upeters again and sorry for my english
    Attached Files

  4. #4
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    I looked at your recent post, and compared it with the version I left here for you. You reinstated several lines from your original project which made no sense at all, showing that you yet didn't understand the new code and just copied what I had done.

    You asked to show text in a Paragraph object, and change a certain image, after a single click in a ListBox, and that help was provided. Now you are saying that it "didn't resolve it" because actually you wish to do something new, like linking to a certain audio file as well.

    Although your new request certainly may use the same mechanism I showed you (simply by adding one more separator and field of information to the List Box entry, setting the ItemData to something like albumart.jpg|Album description|audiofile.mp3), I find that you might want to prefer using a database for this project. A SQL database would allow you to build a much cleaner solution, where you can insert and update new info, without having to rebuild your project. You better should set up a table with one record for each album, with fields for the album name, art, description, and maybe track listing, then fetch the data and display it in your application.

    I made several modifications to your former project. I would suggest that you study what I did and try to understand it before you start to add stuff. Upon clicking an entry in the ListBox (now shown as "Album 1", "Album 2" and "Album3"), the corresponding image to the album is loaded into Image1. At the same time, the text of Paragraph1 is set to the album description. And last, a variable is set, allowing to play an audio clip in a MediaPlayer object corresponding to the album which was selected. As I said, I would suggest that you use SQL if you need further info, as splitting ItemData will quickly become unpractical.

    Ulrich
    Attached Files

  5. #5
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    [offtopic]
    What do you use to make those nice screenshots?
    [/offtopic]
    Quote Originally Posted by upeters View Post
    This can be done a similar way to a recent post I placed here. There are certainly other ways. Here are the modifications I made in your project:

    In the ListBox dialog, you are setting just the image file name. I suggest that you set there as well the text you want to display, or the filename of the text you want to show in the Paragraph object.

    So, instead of just setting "pic1.jpg" as Item Data, set it as "pic1.jpg|This is the text for the first option", for example.



    Then, using Lua, split the information appart and use them in the Image and Paragraph:

    Code:
    tSelected = ListBox.GetSelected("ListBox1");
    if tSelected then
        sFile = ListBox.GetItemData("ListBox1", tSelected[1]);
        -- split the text of the Item Data: separate the image name and paragraph text (or file name, see below)
    
        separator = String.Find(sFile, "|");
        image = String.Mid(sFile, 1, separator-1);
        text = String.Mid(sFile, separator+1, -1);
    
        -- Load filename into Image object
        Image.Load("Image1", "AutoPlay\\Images\\" .. image);
    
        -- set the text of the paragraph object 
        Paragraph.SetText("Paragraph1", text);
    	
        -- if the text should be a filename instead, just modify accordingly,
        -- using something like this (modify to fit your needs):
        -- textfile = TextFile.ReadToString("AutoPlay\\Docs\\" .. text);
        -- Paragraph.SetText("Paragraph1", textfile);
    end
    Ulrich
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  6. #6
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    For screenshots I use SnagIt, currently at version 9.

    Ulrich

  7. #7
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by upeters View Post
    For screenshots I use SnagIt, currently at version 9.

    Ulrich
    Thanks
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  8. #8
    Join Date
    Jul 2003
    Posts
    29
    thank you upeters

  9. #9
    Join Date
    Jul 2003
    Posts
    29
    Now, In this project I would like to open a folder bedides opening m3u from the same listbox , how i do it?
    Last edited by nopal; 06-26-2009 at 05:43 AM.

Similar Threads

  1. Listbox to Paragraph > Print
    By Lookinghawk in forum AutoPlay Media Studio 6.0
    Replies: 11
    Last Post: 05-28-2008, 08:58 AM
  2. How To Link a ListBox With Paragraph Object
    By GhostX in forum AutoPlay Media Studio 7.5
    Replies: 7
    Last Post: 11-20-2007, 10:06 AM
  3. Help with listbox and paragraph text
    By airwv in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 06-07-2007, 07:49 AM
  4. ListBox & Paragraph
    By romaco in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 04-28-2007, 09:29 AM
  5. ListBox and Paragraph - Image
    By romaco in forum AutoPlay Media Studio 6.0
    Replies: 0
    Last Post: 12-18-2006, 03:20 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