home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
listcontrol not displaying?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Piercy" data-source="post: 853763" data-attributes="member: 118026"><p>Hey im new to plugin development and trying to just get to grips with it but im having some issues displaying a list (other controls work fine..), See below for the skin xml, the class.cs file and the attached screenshot of it in action. The button works and displays the alert fine. I also checked the log files and there are no errors (well not related to me anyway some weather error). Please help <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p> </p><p>skin xml file:</p><p>[CODE]<window></p><p> <id>1289</id></p><p> <defaultcontrol>2</defaultcontrol></p><p> <allowoverlay>yes</allowoverlay></p><p> <controls></p><p> </p><p> </p><p> </p><p> <control></p><p> <description>an Image</description></p><p> <type>image</type></p><p> <id>5</id></p><p> <posX>75</posX></p><p> <posY>370</posY></p><p> <texture>hover_my videos.png</texture></p><p> </control></p><p> </p><p> <control></p><p> <description>text label</description></p><p> <type>label</type></p><p> <id>1</id></p><p> <posX>250</posX></p><p> <posY>70</posY></p><p> <label>Some text</label></p><p> <font>font16</font></p><p> <align>right</align></p><p> <textcolor>ffffffff</textcolor></p><p> </control></p><p> </p><p> <control></p><p> <description>Try Me</description></p><p> <type>button</type></p><p> <id>2</id></p><p> <posX>60</posX></p><p> <posY>97</posY></p><p> <label>Try Me</label></p><p> <onleft>2</onleft></p><p> <onright>2</onright></p><p> <onup>2</onup></p><p> <ondown>3</ondown></p><p> </control></p><p> </p><p> <control></p><p> <description>listing</description></p><p> <type>listcontrol</type></p><p> <id>400</id></p><p> <posX>60</posX></p><p> <posY>131</posY></p><p> <height>500</height></p><p> <width>100</width></p><p> <onleft>2</onleft></p><p> </control></p><p> </p><p> </controls></p><p></window>[/CODE]</p><p> </p><p>Class file code:</p><p>[CODE]</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.GUI.Library;</p><p>using MediaPortal.Dialogs;</p><p>using MediaPortal.Common.Utils;</p><p> </p><p>[assembly: CompatibleVersion("1.1.6.27644")]</p><p>[assembly: UsesSubsystem("MP.SkinEngine")]</p><p>[assembly: UsesSubsystem("MP.Config")]</p><p>namespace MPTest</p><p>{</p><p> public class MPTest : GUIWindow, ISetupForm</p><p> {</p><p> </p><p> [SkinControlAttribute(2)]</p><p> protected GUIButtonControl buttonOne = null;</p><p> </p><p> </p><p> [SkinControlAttribute(400)]</p><p> protected GUIListControl guiList = null;</p><p> </p><p> public override bool Init()</p><p> {</p><p> return Load(GUIGraphicsContext.Skin + @"\MPTest.xml");</p><p> }</p><p> public virtual void OnPageLoad()</p><p> {</p><p> GUIListItem itemOne = new GUIListItem("Hello 1");</p><p> GUIListItem itemTwo = new GUIListItem("Hello 2");</p><p> GUIListItem itemThree = new GUIListItem("Hello 3");</p><p> </p><p> guiList.ListItems.Add(itemOne);</p><p> guiList.ListItems.Add(itemTwo);</p><p> guiList.ListItems.Add(itemThree);</p><p> </p><p> }</p><p> protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)</p><p> {</p><p> if (control == buttonOne)</p><p> OnButtonOne();</p><p> </p><p> base.OnClicked(controlId, control, actionType);</p><p> }</p><p> </p><p> private void OnButtonOne()</p><p> {</p><p> GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);</p><p> dlg.SetHeading("Button has been pressed");</p><p> dlg.SetLine(1, "You pressed button 1");</p><p> dlg.SetLine(2, String.Empty);</p><p> dlg.SetLine(3, String.Empty);</p><p> dlg.DoModal(GUIWindowManager.ActiveWindow);</p><p> }</p><p> </p><p> private void OnButtonTwo()</p><p> {</p><p> GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);</p><p> dlg.SetHeading("Button has been pressed");</p><p> dlg.SetLine(1, "You pressed button 2");</p><p> dlg.SetLine(2, String.Empty);</p><p> dlg.SetLine(3, String.Empty);</p><p> dlg.DoModal(GUIWindowManager.ActiveWindow);</p><p> }</p><p> </p><p> </p><p> #region ISetupForm Members</p><p> </p><p> // Returns the name of the plugin which is shown in the plugin menu</p><p> public string PluginName()</p><p> {</p><p> return "MPTest";</p><p> }</p><p> </p><p> // Returns the description of the plugin is shown in the plugin menu</p><p> public string Description()</p><p> {</p><p> return "Media Portal Test plugin";</p><p> }</p><p> </p><p> // Returns the author of the plugin which is shown in the plugin menu</p><p> public string Author()</p><p> {</p><p> return "Piercy";</p><p> }</p><p> </p><p> // show the setup dialog</p><p> public void ShowPlugin()</p><p> {</p><p> MessageBox.Show("Nothing to configure, this is just an example");</p><p> }</p><p> </p><p> // Indicates whether plugin can be enabled/disabled</p><p> public bool CanEnable()</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> // Get Windows-ID</p><p> public int GetWindowId()</p><p> {</p><p> // WindowID of windowplugin belonging to this setup</p><p> // enter your own unique code</p><p> return 1289;</p><p> }</p><p> </p><p> // Indicates if plugin is enabled by default;</p><p> public bool DefaultEnabled()</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> // indicates if a plugin has it's own setup screen</p><p> public bool HasSetup()</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> /// <summary></p><p> /// If the plugin should have it's own button on the main menu of MediaPortal then it</p><p> /// should return true to this method, otherwise if it should not be on home</p><p> /// it should return false</p><p> /// </summary></p><p> /// <param name="strButtonText">text the button should have</param></p><p> /// <param name="strButtonImage">image for the button, or empty for default</param></p><p> /// <param name="strButtonImageFocus">image for the button, or empty for default</param></p><p> /// <param name="strPictureImage">subpicture for the button or empty for none</param></p><p> /// <returns>true : plugin needs it's own button on home</p><p> /// false : plugin does not need it's own button on home</returns></p><p> </p><p> public bool GetHome(out string strButtonText, out string strButtonImage,</p><p> out string strButtonImageFocus, out string strPictureImage)</p><p> {</p><p> strButtonText = String.Empty;</p><p> strButtonImage = String.Empty;</p><p> strButtonImageFocus = String.Empty;</p><p> strPictureImage = String.Empty;</p><p> return true;</p><p> }</p><p> </p><p> // With GetID it will be an window-plugin / otherwise a process-plugin</p><p> // Enter the id number here again</p><p> public override int GetID</p><p> {</p><p> get</p><p> {</p><p> return 1289;</p><p> }</p><p> </p><p> set</p><p> {</p><p> }</p><p> }</p><p> </p><p> #endregion</p><p> </p><p> }</p><p> </p><p>}</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="Piercy, post: 853763, member: 118026"] Hey im new to plugin development and trying to just get to grips with it but im having some issues displaying a list (other controls work fine..), See below for the skin xml, the class.cs file and the attached screenshot of it in action. The button works and displays the alert fine. I also checked the log files and there are no errors (well not related to me anyway some weather error). Please help :) skin xml file: [CODE]<window> <id>1289</id> <defaultcontrol>2</defaultcontrol> <allowoverlay>yes</allowoverlay> <controls> <control> <description>an Image</description> <type>image</type> <id>5</id> <posX>75</posX> <posY>370</posY> <texture>hover_my videos.png</texture> </control> <control> <description>text label</description> <type>label</type> <id>1</id> <posX>250</posX> <posY>70</posY> <label>Some text</label> <font>font16</font> <align>right</align> <textcolor>ffffffff</textcolor> </control> <control> <description>Try Me</description> <type>button</type> <id>2</id> <posX>60</posX> <posY>97</posY> <label>Try Me</label> <onleft>2</onleft> <onright>2</onright> <onup>2</onup> <ondown>3</ondown> </control> <control> <description>listing</description> <type>listcontrol</type> <id>400</id> <posX>60</posX> <posY>131</posY> <height>500</height> <width>100</width> <onleft>2</onleft> </control> </controls> </window>[/CODE] Class file code: [CODE] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using MediaPortal.GUI.Library; using MediaPortal.Dialogs; using MediaPortal.Common.Utils; [assembly: CompatibleVersion("1.1.6.27644")] [assembly: UsesSubsystem("MP.SkinEngine")] [assembly: UsesSubsystem("MP.Config")] namespace MPTest { public class MPTest : GUIWindow, ISetupForm { [SkinControlAttribute(2)] protected GUIButtonControl buttonOne = null; [SkinControlAttribute(400)] protected GUIListControl guiList = null; public override bool Init() { return Load(GUIGraphicsContext.Skin + @"\MPTest.xml"); } public virtual void OnPageLoad() { GUIListItem itemOne = new GUIListItem("Hello 1"); GUIListItem itemTwo = new GUIListItem("Hello 2"); GUIListItem itemThree = new GUIListItem("Hello 3"); guiList.ListItems.Add(itemOne); guiList.ListItems.Add(itemTwo); guiList.ListItems.Add(itemThree); } protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == buttonOne) OnButtonOne(); base.OnClicked(controlId, control, actionType); } private void OnButtonOne() { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlg.SetHeading("Button has been pressed"); dlg.SetLine(1, "You pressed button 1"); dlg.SetLine(2, String.Empty); dlg.SetLine(3, String.Empty); dlg.DoModal(GUIWindowManager.ActiveWindow); } private void OnButtonTwo() { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlg.SetHeading("Button has been pressed"); dlg.SetLine(1, "You pressed button 2"); dlg.SetLine(2, String.Empty); dlg.SetLine(3, String.Empty); dlg.DoModal(GUIWindowManager.ActiveWindow); } #region ISetupForm Members // Returns the name of the plugin which is shown in the plugin menu public string PluginName() { return "MPTest"; } // Returns the description of the plugin is shown in the plugin menu public string Description() { return "Media Portal Test plugin"; } // Returns the author of the plugin which is shown in the plugin menu public string Author() { return "Piercy"; } // show the setup dialog public void ShowPlugin() { MessageBox.Show("Nothing to configure, this is just an example"); } // Indicates whether plugin can be enabled/disabled public bool CanEnable() { return true; } // Get Windows-ID public int GetWindowId() { // WindowID of windowplugin belonging to this setup // enter your own unique code return 1289; } // Indicates if plugin is enabled by default; public bool DefaultEnabled() { return true; } // indicates if a plugin has it's own setup screen public bool HasSetup() { return true; } /// <summary> /// If the plugin should have it's own button on the main menu of MediaPortal then it /// should return true to this method, otherwise if it should not be on home /// it should return false /// </summary> /// <param name="strButtonText">text the button should have</param> /// <param name="strButtonImage">image for the button, or empty for default</param> /// <param name="strButtonImageFocus">image for the button, or empty for default</param> /// <param name="strPictureImage">subpicture for the button or empty for none</param> /// <returns>true : plugin needs it's own button on home /// false : plugin does not need it's own button on home</returns> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { strButtonText = String.Empty; strButtonImage = String.Empty; strButtonImageFocus = String.Empty; strPictureImage = String.Empty; return true; } // With GetID it will be an window-plugin / otherwise a process-plugin // Enter the id number here again public override int GetID { get { return 1289; } set { } } #endregion } } [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
listcontrol not displaying?
Contact us
RSS
Top
Bottom