Need advise on guicontrols (guilistcontrol) (1 Viewer)

boein

Portal Member
May 1, 2006
40
11
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:

Spragleknas

Moderator
  • Team MediaPortal
  • December 21, 2005
    9,474
    1,822
    Located
    Home Country
    Norway Norway
    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:
     

    Dadeo

    Docs Group Manager
  • Premium Supporter
  • November 26, 2006
    5,340
    3,321
    Himalayas, India
    Home Country
    Canada Canada
    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:

    boein

    Portal Member
    May 1, 2006
    40
    11
    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
     

    boein

    Portal Member
    May 1, 2006
    40
    11
    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
     

    Brownard

    Development Group
  • Team MediaPortal
  • March 21, 2007
    2,290
    1,872
    Home Country
    United Kingdom United Kingdom
    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.
     

    boein

    Portal Member
    May 1, 2006
    40
    11
    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
     

    Brownard

    Development Group
  • Team MediaPortal
  • March 21, 2007
    2,290
    1,872
    Home Country
    United Kingdom United Kingdom
    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.
     

    Users who are viewing this thread

    Top Bottom