Need advise on guicontrols (guilistcontrol)

Discussion in 'MediaPortal 1 Plugins' started by boein, May 21, 2012.

  1. boein

    boein Portal Member

    Joined:
    May 1, 2006
    Messages:
    40
    Likes Received:
    11
    Ratings:
    +11 / 0
    Hi,

    I'm working on a new plugin "MPonlineMixes". With the plugin you can search for mp3-mixes in a sound-cloud portal that returns results with relevant info about the mix (genre, artist, title, picture...). If you click on a result the mix is played. The plugin works, gets the content, but I cannot display it properly the way I want.

    The idea is to show the content in tabular-layout like this:
    Mix-Title - artist - genre - link to the mix (hidden) and a picture
    Mix2-Title - artist - genre - link to the mix (hidden) and a picture
    Mix3-Title - artist - genre - link to the mix (hidden) and a picture

    Did some tests with listcontrol examples from the wiki but I just can't get it right. In liscontrol you can use label,label2 and label3, but I don't know how to position them to get them aligned in table-form, they always overlap. Or maybe there's an easier way to show the content in a table. Can someone give me an example of the code and the corresponding XML? The wiki doesn't really help me here.
    Also about the X,Y positions and offset, the integers used are based on what? What is the minimum, maximum value based on, where can I find this value. For the moment I have to position controls by means of trial and error, try some values, check the output on the screen... I don't think this is the way to do it, right ? So tips about "proper positioning" are much appreciated :)



    Thanks
    Boein
     
    Last edited: May 24, 2012
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. boein

    boein Portal Member

    Joined:
    May 1, 2006
    Messages:
    40
    Likes Received:
    11
    Ratings:
    +11 / 0
    After 5 days still no response for this, imho, simple question? Anyone?
     
  4. Spragleknas
    • Team MediaPortal
    • Administrator

    Spragleknas Administrator

    Joined:
    December 21, 2005
    Messages:
    9,472
    Likes Received:
    1,385
    Gender:
    Male
    Occupation:
    Occupied
    Location:
    Located
    Ratings:
    +1,892 / 12
    Home Country:
    Norway Norway
    Show System Specs
    Probably just missed.... I believe that many of team-members who normally would answer this is spending time on 1.3alpha instead of browsing these forums.... :sorry:
     
  5. Dadeo
    • Premium Supporter

    Dadeo Docs Group Manager

    Joined:
    November 26, 2006
    Messages:
    5,340
    Likes Received:
    2,802
    Location:
    Himalayas, India
    Ratings:
    +3,053 / 0
    Home Country:
    Canada Canada
    Show System Specs
    Sorry boein, I don't know much about plugin development, but yeah label3 will often overlap unless the skin files use a larger texture height and <textYOff3> to display label3 on a second line. That is why many music plugins (including MP Music) implement Big Icon list layout (listcontrol subtype: album) so users have a choice between a quick list or all details. That might work for you?

    AFAIK the skin controls the positioning of text in a listcontrol via the textX and textY tags (for label1,2,3). You will see those settings in references.xml in Default skin (under default listcontrol settings).

    I'm not sure if that helps you, I hope so!
     
    Last edited: May 24, 2012
    • Like Like x 1
  6. boein

    boein Portal Member

    Joined:
    May 1, 2006
    Messages:
    40
    Likes Received:
    11
    Ratings:
    +11 / 0
    Another "simple problem" :)
    First time I enter my plugin doing a "search" my listcontrol gets filled with data. When I go back (using back or clicking "now playing") and reenter the plugin the listcontrol is empty again. This is because the arraylist linked to the control looses it's contents. Is there a way to keep the data on exit? I know for sure the array is not erased on exit.

    thanks
    Boein
     
  7. boein

    boein Portal Member

    Joined:
    May 1, 2006
    Messages:
    40
    Likes Received:
    11
    Ratings:
    +11 / 0
    Ok discovered something weird,
    all the settings seem to be "remembered" when you generate an indirect error in onpagedestroy() sub? During various test (while waiting for an answer on the forum :) ) a modification in the code suddenly fixed my problem. I checked the code and discovered a null variable was referenced, but no error was shown?? So I did a test and replaced the code by these lines

    dim x as integer = 1
    x=x/0

    and yes this also works. So I guess errors on onpagedestroy() are suppressed and when leaving the module in a bad way the variables and controls are not cleaned properly. If this is true isn't there a simple parameter to decide if the vars should be cleaned or not?

    Regards,
    Boein
     
  8. Brownard
    • Team MediaPortal

    Brownard Development Group

    Joined:
    March 21, 2007
    Messages:
    1,919
    Likes Received:
    789
    Gender:
    Male
    Ratings:
    +1,327 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    You do have to re-populate the controls yourself every time the page is loaded. Your local variables will retain their values though so you can implement your own method of remembering state and refreshing the controls as required.
     
  9. boein

    boein Portal Member

    Joined:
    May 1, 2006
    Messages:
    40
    Likes Received:
    11
    Ratings:
    +11 / 0
    too bad,
    in the end geneating an error gives the same result as writing a lot of extra code to get your controls "refilled". What's the difference if your local variables stay in memory and the guicontrols don't?
    Regards,
    Boein
     
  10. Brownard
    • Team MediaPortal

    Brownard Development Group

    Joined:
    March 21, 2007
    Messages:
    1,919
    Likes Received:
    789
    Gender:
    Male
    Ratings:
    +1,327 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    You'll probably find you (and everyone that uses your plugin) will have issues/memory leaks if you do not allow your page to be destroyed properly. I think all the controls are re-created on load as per your skin file (probably to reduce memory usage). It would be fairly easy to create a 'refresh' method. A simple (but probably not the best) way would be to copy all the ListItems to your own List/Array in OnPageDestroy(), and copy them back on the next OnPageLoad.
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!