MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Community Skins and Plugins » Plugins


Plugins Plugins developed and maintained by users. Want to create your own plugin? Start a thread in here.

Reply
 
Thread Tools Display Modes
Old 2006-08-12, 00:15   #1 (permalink)
Portal Member
 
Join Date: Aug 2006
Location: Southsea, UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


Default GUI List Control

Hello,

I am currently developing my first plugin for MP (a PDF ebook reader). I have read the "how to develop your first plugin" but that doesn't seem to help with this. I am trying to add a list control to my GUI which will load all the names of the ebooks into it - a similar layout to the my music plugin.

At the moment I am just trying to add an item to the list but it just doesn't show!

I'm initialising the list control with the following -
Code:
[SkinControlAttribute(21)]
        protected GUIListControl lstEbooks = null;
Then trying to add an item to it with the following -
Code:
lstEbooks.Add(new GUIListItem("A new item!"));
This the part in my XML file that declares the facade view (borrowed this from the My Music plugin) -
Code:
		<control>
			<type>group</type>
			<description>group element</description>
			<animation>FlyInFromTop</animation>
			<posX>120</posX>
			<posY>97</posY>
			<width>50</width>
			<height>60</height>
			<control>
				<description>composite control consisting of a list control and a thumbnail panel</description>
				<type>facadeview</type>
				<id>20</id>
				<control>
					<description>listcontrol</description>
					<type>listcontrol</type>
					<id>21</id>
					<width>50</width>
					<height>60</height>
					<onleft>2</onleft>
					<onright>51</onright>
					<onup>2</onup>
					<ondown>2</ondown>
					<textcolor>FFFFFFFF</textcolor>
				</control>
				<control>
					<description>Thumbnail Panel</description>
					<type>thumbnailpanel</type>
					<id>22</id>
					<onleft>2</onleft>
					<onright>52</onright>
					<onup>2</onup>
					<ondown>2</ondown>
				</control>
			</control>
Any help would be greatly appreciated!

Cheers,
JestriK
__________________
Epia VIA 10000M :: 1GB RAM :: GeForce Low Profile 6600 :: 1x 300GB HDD :: 1x 250GB HDD :: MS Wireless Mouse and Keyboard :: MCE 2005 Remote
JestriK is offline   Reply With Quote
Old 2006-08-12, 00:40   #2 (permalink)
Portal Member
 
Join Date: Aug 2006
Location: Southsea, UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


Default

Just to make it clearer, this is what i can see on my screen -

__________________
Epia VIA 10000M :: 1GB RAM :: GeForce Low Profile 6600 :: 1x 300GB HDD :: 1x 250GB HDD :: MS Wireless Mouse and Keyboard :: MCE 2005 Remote
JestriK is offline   Reply With Quote
Old 2006-08-12, 03:05   #3 (permalink)
Portal Member
 
Join Date: Aug 2006
Location: Southsea, UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


Default

OK, since my last post have figured out what I was doing wrong - I should be using a GUIFacadeControl.

Now I've got that sorted that out, I have the code below.

Code:
private void LoadList(string currentDirectory)
{
  ArrayList arry = new ArrayList();
  arry.Add(".pdf");
  virtualDirectory.SetExtensions(arry);

  List<GUIListItem> items = virtualDirectory.GetDirectoryExt(currentDirectory);

  facadeView.Clear();

  for (int i = 0; items.Count > i; i++)
    facadeView.Add(items[0]);
}
When it gets to adding the items to the facade control it throws the following exception -

Code:
OnMessage exception:System.DivideByZeroException: Attempted to divide by zero.
   at MediaPortal.GUI.Library.GUIListControl.Add(GUIListItem item)
   at MediaPortal.GUI.Library.GUIFacadeControl.Add(GUIListItem item)
   at MediaPortal.GUI.Library.GUIFacadeControl.OnMessage(GUIMessage message)
   at MediaPortal.GUI.Library.GUIWindow.OnMessage(GUIMessage message)
Can anyone see what I'm doing wrong, because I'm stumped!

Cheers,
JestriK
__________________
Epia VIA 10000M :: 1GB RAM :: GeForce Low Profile 6600 :: 1x 300GB HDD :: 1x 250GB HDD :: MS Wireless Mouse and Keyboard :: MCE 2005 Remote
JestriK is offline   Reply With Quote
Old 2006-08-12, 11:43   #4 (permalink)
Portal Member
 
Join Date: Aug 2006
Location: Southsea, UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


Default

I have now fixed this too, it seems there was something wrong with my XML file, I rewrote it and it now seems to work

Sorry for all the posts!

Cheers,
Jes_triK
__________________
Epia VIA 10000M :: 1GB RAM :: GeForce Low Profile 6600 :: 1x 300GB HDD :: 1x 250GB HDD :: MS Wireless Mouse and Keyboard :: MCE 2005 Remote
JestriK is offline   Reply With Quote
Old 2006-08-14, 11:49   #5 (permalink)
Portal Member
 
mbuzina's Avatar
 
Join Date: Apr 2005
Location: Germany
Age: 34
Posts: 457
Thanks: 1
Thanked 2 Times in 2 Posts

Country:


Default

Don't say sorry (sorry nobody answered!). It is good to show what pitfalls there are for developing.
__________________
*** Power is nothing without control ***
mbuzina is offline   Reply With Quote
Old 2006-08-14, 13:12   #6 (permalink)
Portal Developer
 
Join Date: Jan 2006
Age: 28
Posts: 349
Thanks: 7
Thanked 58 Times in 23 Posts

Country:

My System

Default

Try someting like :
Code:
private void LoadList(string currentDirectory)
{
  ArrayList arry = new ArrayList();
  arry.Add(".pdf");
  virtualDirectory.SetExtensions(arry);

  List<GUIListItem> items = virtualDirectory.GetDirectoryExt(currentDirectory);

  facadeView.Clear();

  for (int i = 0; items.Count= > i; i++)
    facadeView.Add(items[i]);
}
__________________
Hungarian MP forum
dukus is offline   Reply With Quote
Reply

Bookmarks

Tags
control, gui, list

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inifinite Loop in GUI List Control TesterBoy 0.2.0.0 Final and SVN Builds 3 2006-09-19 06:36
cant see list control list in my plugin kenny Plugins 1 2006-04-04 20:58
Navigation within 'My Video' & 'My Music' malachy 0.2.0.0 Release Candidate 1 1 2005-11-15 21:27
Finally a Fix for MPexTuneCMD with DTV Control. bitbyte Tips and Tricks 1 2005-10-16 14:24
Simple examle how to populate list control CoolHammer Plugins 6 2004-12-28 14:01


All times are GMT +1. The time now is 09:55.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress
Advertisement System V2.6 By   Branden