Guicontrolsdemo ? come out, come out, whereever you are?

Discussion in 'MediaPortal 1 Talk' started by gpnash, November 14, 2016.

  1. gpnash

    gpnash Portal Pro

    Joined:
    March 2, 2015
    Messages:
    63
    Likes Received:
    5
    Gender:
    Male
    Occupation:
    retired systems programmer
    Location:
    Linden, Michigan
    Ratings:
    +10 / 0
    Home Country:
    United States of America United States of America
    Show System Specs
    Hi, I'm trying my hand a writing a windows plugin using vb.net 4+ mediaportal 1.50.0 and the directions I'm seeing while giving a example that will just about work, fall short in a couple of places. I was hoping to find the guicontrolsdemo mentioned but all links to it result in a 404 not found error.



    specifically I'm trying to find out how to change text the plugin has displayed and create a list (similar to the recorded tv list or the program guide) of shows for approval. so far I haven't been able to get more than a couple of buttons to show up with their dialog boxes (as show in the one online sample)

    Thanks for any and all help..
    guy
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,695
    Likes Received:
    2,684
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,644 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
    • Thank You! Thank You! x 2
  4. gpnash

    gpnash Portal Pro

    Joined:
    March 2, 2015
    Messages:
    63
    Likes Received:
    5
    Gender:
    Male
    Occupation:
    retired systems programmer
    Location:
    Linden, Michigan
    Ratings:
    +10 / 0
    Home Country:
    United States of America United States of America
    Show System Specs
    Thanks for that, but being neither lazy nor an idiot I'd found those days ago.
    the first is a nice description of what I was looking for but the link t"o the repository results in a 404 not found error.
    "https://www.team-mediaportal.com/extensions/guicontrolsdemo"
    "|404| Bad karma, sorry...we can't find that page!
    You asked for this page, but despite our computers looking very hard, we could not find it. What happened ?

    • the link you clicked to arrive here is not valid anymore or has a typo in it
    • or we removed that page, or gave it another name
    • or, quite unlikely for sure, maybe you typed it yourself and there was a little mistake ?
    Please use the search-field on top or start browsing from home-page, thanks!"


    I've followed the second link as far as it'd take me, it unfortunately doesn't give you any clue how to add any kind of list control to the skin page, nor how to populate it from the code page. I've tried..
    Code (Text):
    1.    
    2. <SkinControlAttribute(1)> Protected lblText As GUILabelControl = Nothing
    3.         <SkinControlAttribute(2)> Protected buttonOne As GUIButtonControl = Nothing
    4.         <SkinControlAttribute(3)> Protected buttonTwo As GUIButtonControl = Nothing
    5.         <SkinControlAttribute(4)> Protected myList As GUIListControl = Nothing
    6.         Private _windowID As Integer = 10001
    7.  
    8.       Protected Overrides Sub OnPageLoad()
    9.             lblText.Label = "this is set from the plugin."
    10.             myList.Add(New GUIListItem("test1"))
    11.             myList.Add(New GUIListItem("test2"))
    12.             myList.Add(New GUIListItem("test3"))
    13.         End Sub
    14.  

    which of course doesn't work.

    Thanks again for trying.
     
  5. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,695
    Likes Received:
    2,684
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,644 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
  6. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,695
    Likes Received:
    2,684
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,644 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
  7. gpnash

    gpnash Portal Pro

    Joined:
    March 2, 2015
    Messages:
    63
    Likes Received:
    5
    Gender:
    Male
    Occupation:
    retired systems programmer
    Location:
    Linden, Michigan
    Ratings:
    +10 / 0
    Home Country:
    United States of America United States of America
    Show System Specs
    THANK YOU! :)
    now to see how much trouble I can get into.
     
  8. gpnash

    gpnash Portal Pro

    Joined:
    March 2, 2015
    Messages:
    63
    Likes Received:
    5
    Gender:
    Male
    Occupation:
    retired systems programmer
    Location:
    Linden, Michigan
    Ratings:
    +10 / 0
    Home Country:
    United States of America United States of America
    Show System Specs
    ok... looks like I'm cooking with gas now. Last hurdle.
    seems like the guilistcontrol with it's guilistitem is great for a single column list.
    What do we do for a multiple column list? my requirement is for each line to have a checkbox, date/time, channel,channelname, series name, season/episode, episodetitle
    without a table structure it's difficult to fake columns and I'm not sure how to either skin or access 6 guilistcontrols across the screen....
     
  9. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,695
    Likes Received:
    2,684
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,644 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
    http://wiki.team-mediaportal.com/1_...gins/Plugin_Architecture/Controls/GUIListitem
    You can also try:
    Thumbnail - checkbox image
    Label1 - Chanel name
    Label2 - date/time
    Label3 - SeriesName
    TVTag - All other props
    And show:
    ListControl on one side of window
    Additional text on other side of window with detailed information ... like MyVideo, MyMusic etc
     
  10. gpnash

    gpnash Portal Pro

    Joined:
    March 2, 2015
    Messages:
    63
    Likes Received:
    5
    Gender:
    Male
    Occupation:
    retired systems programmer
    Location:
    Linden, Michigan
    Ratings:
    +10 / 0
    Home Country:
    United States of America United States of America
    Show System Specs
    Guess I just don't get it.... but then again the windows 10 universal windows code baffles me too. windows forms... that I understand.

    Thanks for the last straw.. Here's the working vb example....



    Code (Text):
    1.  
    2.  <window>
    3.   <id>10001</id>
    4.   <defaultcontrol>3</defaultcontrol>
    5.   <allowoverlay>yes</allowoverlay>
    6.   <controls>
    7.     <control>
    8.       <id>0</id>
    9.       <type>image</type>
    10.       <posX>66</posX>
    11.       <posY>34</posY>
    12.       <width>61</width>
    13.       <height>57</height>
    14.       <texture>icon_tv.png</texture>
    15.       <animation effect="fade" time="250">WindowOpen</animation>
    16.       <animation effect="fade" time="250">WindowClose</animation>
    17.     </control>
    18.     <import>common.time.xml</import>
    19.     <control>
    20.       <description>Refresh</description>
    21.       <type>button</type>
    22.       <id>3</id>
    23.       <posX>100</posX>
    24.       <posY>175</posY>
    25.       <height>60</height>
    26.       <onleft>3</onleft>
    27.       <onright>3</onright>
    28.       <onup>3</onup>
    29.       <ondown>4</ondown>
    30.       <label>Refresh</label>
    31.     </control>
    32.     <control>
    33.       <description>text label</description>
    34.       <type>label</type>
    35.       <id>2</id>
    36.       <posX>100</posX>
    37.       <posY>240</posY>
    38.       <label></label>
    39.       <font>font16</font>
    40.       <align>left</align>
    41.       <textcolor>ffffffff</textcolor>
    42.     </control>
    43.     <control>
    44.       <description>GuiList</description>
    45.       <type>listcontrol</type>
    46.       <id>4</id>
    47.       <posX>100</posX>
    48.       <posY>305</posY>
    49.       <scrollOffset>2</scrollOffset>
    50.       <font>font10</font>
    51.       <align>left</align>
    52.       <onleft>3</onleft>
    53.       <onright>3</onright>
    54.       <textcolor>ffffffff</textcolor>
    55.       <unfocusedAlpha>160</unfocusedAlpha>
    56.     </control>
    57.   </controls>
    58. </window>
    59.  
    Code (Text):
    1.  
    2. Imports System
    3.  
    4. Imports System.Windows.Forms
    5.  
    6. Imports MediaPortal.GUI.Library
    7.  
    8. Imports MediaPortal.Dialogs
    9.  
    10.  
    11.  
    12. Namespace MPtvApprove
    13.  
    14. ' http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins/Plugin_Developer's_Guide/1_Develop_a_Plugin/Visual_Basic
    15.  
    16. Public Class TvApprove
    17.  
    18. Inherits GUIWindow
    19.  
    20. Implements ISetupForm
    21.  
    22. <SkinControlAttribute(2)> Protected lblText As GUILabelControl = Nothing
    23.  
    24. <SkinControlAttribute(3)> Protected buttonOne As GUIButtonControl = Nothing
    25.  
    26. <SkinControlAttribute(4)> Protected myList As GUIListControl = Nothing
    27.  
    28. Private _windowID As Integer = 10001
    29.  
    30. Private errors As String = String.Empty
    31.  
    32. ' With GetID it will be an window-plugin / otherwise a process-plugin
    33.  
    34. ' Enter the id number here again
    35.  
    36. Public Overrides Property GetID As Integer
    37.  
    38. Get
    39.  
    40. Return _windowID
    41.  
    42. End Get
    43.  
    44. Set(value As Integer)
    45.  
    46. _windowID = value
    47.  
    48. End Set
    49.  
    50. End Property
    51.  
    52. Public Overrides Function Init() As Boolean
    53.  
    54. Dim result As Boolean = Load(GUIGraphicsContext.Skin + "\MPtvapprove.xml")
    55.  
    56. Return result
    57.  
    58. End Function
    59.  
    60. Protected Overrides Sub OnPageLoad()
    61.  
    62. GUIPropertyManager.SetProperty("#header.label", "TV Approve for Recording")
    63.  
    64. myList.Clear()
    65.  
    66. errors = String.Empty
    67.  
    68. myList.SetTextOffsets(100, 0, 1090, 0, 1100, 0)
    69.  
    70. myList.IconOffsetX = 0
    71.  
    72. myList.IconOffsetY = 0
    73.  
    74. myList.TypeOfList = GUIListControl.ListType.CONTROL_LIST
    75.  
    76. myList.Space = 1
    77.  
    78. For Each candidate As tvCandidate In getTitlesToApprove()
    79.  
    80. myList.Add(candidate.toGuiListItem)
    81.  
    82. Next
    83.  
    84. errors += If(errors.Length > 0, "\n", "")
    85.  
    86. lblText.Label = errors + "found:" + myList.Count.ToString + " records"
    87.  
    88. MyBase.OnPageLoad()
    89.  
    90. End Sub
    91.  
    92. Public Sub New()
    93.  
    94. MyBase.New
    95.  
    96. End Sub
    97.  
    98. Public Function PluginName() As String Implements ISetupForm.PluginName
    99.  
    100. Return "TvApprove"
    101.  
    102. End Function
    103.  
    104. Public Function Description() As String Implements ISetupForm.Description
    105.  
    106. Return "TvApprove - Approve selected TVshows for recording."
    107.  
    108. End Function
    109.  
    110. Public Function Author() As String Implements ISetupForm.Author
    111.  
    112. Return "Guy Nash"
    113.  
    114. End Function
    115.  
    116. Public Sub ShowPlugin() Implements ISetupForm.ShowPlugin
    117.  
    118. MessageBox.Show("Nothing to configure, this is just an example")
    119.  
    120. End Sub
    121.  
    122. Public Function CanEnable() As Boolean Implements ISetupForm.CanEnable
    123.  
    124. Return True
    125.  
    126. End Function
    127.  
    128. ' Get Windows-ID
    129.  
    130. Public Function GetWindowId() As Integer Implements ISetupForm.GetWindowId
    131.  
    132. Return _windowID
    133.  
    134. End Function
    135.  
    136. Public Function DefaultEnabled() As Boolean Implements ISetupForm.DefaultEnabled
    137.  
    138. Return True
    139.  
    140. End Function
    141.  
    142. Public Function HasSetup() As Boolean Implements ISetupForm.HasSetup
    143.  
    144. Return False
    145.  
    146. End Function
    147.  
    148. ''' <summary>
    149.  
    150. ''' If the plugin should have it's own button on the main menu of MediaPortal then it
    151.  
    152. ''' should return true to this method, otherwise if it should not be on home
    153.  
    154. ''' it should return false
    155.  
    156. ''' </summary>
    157.  
    158. ''' <param name="strButtonText">text the button should have</param>
    159.  
    160. ''' <param name="strButtonImage">image for the button, or empty for default</param>
    161.  
    162. ''' <param name="strButtonImageFocus">image for the button, or empty for default</param>
    163.  
    164. ''' <param name="strPictureImage">subpicture for the button or empty for none</param>
    165.  
    166. ''' <returns>true : plugin needs it's own button on home
    167.  
    168. ''' false : plugin does not need it's own button on home</returns>
    169.  
    170. Public Function GetHome(ByRef strButtonText As String, ByRef strButtonImage As String, ByRef strButtonImageFocus As String, ByRef strPictureImage As String) As Boolean Implements ISetupForm.GetHome
    171.  
    172. strButtonText = PluginName()
    173.  
    174. strButtonImage = "c:\\programdata\\team mediaportal\\mediaportal\\skin\\Titan\\Media\\hover_my tv.png"
    175.  
    176. strButtonImageFocus = [String].Empty
    177.  
    178. strPictureImage = [String].Empty
    179.  
    180. Return True
    181.  
    182. End Function
    183.  
    184. Public Overrides Function OnMessage(ByVal message As GUIMessage) As Boolean
    185.  
    186. Select Case message.Message
    187.  
    188. Case GUIMessage.MessageType.GUI_MSG_CLICKED
    189.  
    190. If message.SenderControlId = myList.GetID Then
    191.  
    192. If CType(MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM, Integer) = message.Param1 Then
    193.  
    194. Dim item As GUIListItem = myList.SelectedListItem
    195.  
    196. 'MessageBox.Show("msg:" + item.IconImage)
    197.  
    198. item.Selected = item.IconImage.ToLower.EndsWith("checkmark_unchecked.png")
    199.  
    200. item.IconImage = If(item.Selected, "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_checked.png", "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png")
    201.  
    202. Return True
    203.  
    204. End If
    205.  
    206. End If
    207.  
    208. Case Else
    209.  
    210. End Select
    211.  
    212. Return MyBase.OnMessage(message)
    213.  
    214. End Function
    215.  
    216. Protected Overrides Sub OnClicked(ByVal controlId As Integer, ByVal control As GUIControl, ByVal actionType As MediaPortal.GUI.Library.Action.ActionType)
    217.  
    218. Select Case controlId
    219.  
    220. Case buttonOne.GetID
    221.  
    222. OnButtonOne()
    223.  
    224. Case myList.GetID
    225.  
    226. Dim item As GUIListItem = myList.SelectedListItem
    227.  
    228. 'MessageBox.Show(item.IconImage)
    229.  
    230. item.Selected = item.IconImage.ToLower.EndsWith("checkmark_unchecked.png")
    231.  
    232. item.IconImage = If(item.Selected, "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_checked.png", "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png")
    233.  
    234. Case Else
    235.  
    236. End Select
    237.  
    238. MyBase.OnClicked(controlId, control, actionType)
    239.  
    240. End Sub
    241.  
    242. Private Sub OnButtonOne()
    243.  
    244. myList.Clear()
    245.  
    246. myList.SetTextOffsets(100, 0, 1090, 0, 1100, 0)
    247.  
    248. myList.IconOffsetX = 0
    249.  
    250. myList.IconOffsetY = 0
    251.  
    252. myList.Space = 1
    253.  
    254. For Each candidate As tvCandidate In getTitlesToApprove()
    255.  
    256. myList.Add(candidate.toGuiListItem)
    257.  
    258. Next
    259.  
    260. errors += If(errors.Length > 0, "\r", "")
    261.  
    262. lblText.Label = errors + "found:" + myList.Count.ToString + " records"
    263.  
    264. End Sub
    265.  
    266. Function getTitlesToApprove() As List(Of tvCandidate)
    267.  
    268. Dim result As List(Of tvCandidate) = New List(Of tvCandidate)
    269.  
    270. errors = String.Empty
    271.  
    272. Try
    273.  
    274. Using c0 As SqlClient.SqlConnection = New SqlClient.SqlConnection("server=mediaportalserv;user id=xx;password=xxxxxxxx;database=mptvdb;")
    275.  
    276. c0.Open()
    277.  
    278. Using c1 As SqlClient.SqlCommand = New SqlClient.SqlCommand("select idprogram,series,episode,season,episodenumber,dbchannelid,channel,channeldisplayname,starttime,endtime from tvshowcandidates where starttime > getdate() order by starttime,series,channel desc", c0)
    279.  
    280. Using c2 As SqlClient.SqlDataReader = c1.ExecuteReader
    281.  
    282. If c2.HasRows Then
    283.  
    284. While c2.Read
    285.  
    286. result.Add(New tvCandidate(c2))
    287.  
    288. End While
    289.  
    290. End If
    291.  
    292. End Using
    293.  
    294. End Using
    295.  
    296. c0.Close()
    297.  
    298. End Using
    299.  
    300. Catch ex As Exception
    301.  
    302. Dim a As tvCandidate = New tvCandidate
    303.  
    304. a.series = ex.Message
    305.  
    306. result.Add(a)
    307.  
    308. errors += "\r" + ex.Message
    309.  
    310. End Try
    311.  
    312. Return result
    313.  
    314. End Function
    315.  
    316. End Class
    317.  
    318. End Namespace
    319.  
    Code (Text):
    1.  
    2. Imports MediaPortal.GUI.Library
    3.  
    4. Imports MediaPortal.Dialogs
    5.  
    6. Public Class tvCandidate
    7.  
    8. Public idprogram As Integer
    9.  
    10. Public series As String
    11.  
    12. Public episode As String
    13.  
    14. Public season As String
    15.  
    16. Public episodenumber As String
    17.  
    18. Public dbchannelid As Integer
    19.  
    20. Public channel As String
    21.  
    22. Public channeldisplayname As String
    23.  
    24. Public starttime As DateTime
    25.  
    26. Public endtime As DateTime
    27.  
    28. Public Sub New()
    29.  
    30. End Sub
    31.  
    32. Public Sub New(ByVal i() As Object)
    33.  
    34. idprogram = i(0)
    35.  
    36. series = i(1)
    37.  
    38. episode = i(2)
    39.  
    40. season = i(3)
    41.  
    42. episodenumber = i(4)
    43.  
    44. dbchannelid = i(5)
    45.  
    46. channel = i(6)
    47.  
    48. channeldisplayname = i(7)
    49.  
    50. starttime = i(8)
    51.  
    52. endtime = i(9)
    53.  
    54. End Sub
    55.  
    56. Public Sub New(ByVal i0 As Integer, ByVal i1 As String, ByVal i2 As String, ByVal i3 As String, ByVal i4 As String, ByVal i5 As Integer, ByVal i6 As String, ByVal i7 As String, ByVal i8 As DateTime, ByVal i9 As DateTime)
    57.  
    58. Me.New({i0, i1, i2, i3, i4, i5, i6, i7, i8, i9})
    59.  
    60. End Sub
    61.  
    62. Public Sub New(ByVal sqlrdr As SqlClient.SqlDataReader)
    63.  
    64. Dim i() As Object = {New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object}
    65.  
    66. Dim mydefault() As Object = {-1, String.Empty, String.Empty, String.Empty, String.Empty, -1, String.Empty, String.Empty, Date.MinValue, Date.MinValue}
    67.  
    68. For j = 0 To 9
    69.  
    70. i(j) = getSQLvalue(sqlrdr, j, mydefault(j))
    71.  
    72. Next
    73.  
    74. idprogram = i(0)
    75.  
    76. series = i(1)
    77.  
    78. episode = i(2)
    79.  
    80. season = i(3)
    81.  
    82. episodenumber = i(4)
    83.  
    84. dbchannelid = i(5)
    85.  
    86. channel = i(6)
    87.  
    88. channeldisplayname = i(7)
    89.  
    90. starttime = i(8)
    91.  
    92. endtime = i(9)
    93.  
    94. End Sub
    95.  
    96. Private Function getSQLvalue(ByVal r As SqlClient.SqlDataReader, ByVal c As Integer, ByVal empty As Object) As Object
    97.  
    98. Dim result As Object = empty
    99.  
    100. If r.IsDBNull(c) Then
    101.  
    102. Else
    103.  
    104. result = r.GetValue(c)
    105.  
    106. End If
    107.  
    108. Return result
    109.  
    110. End Function
    111.  
    112. Public Function toGuiListItem() As GUIListItem
    113.  
    114. Dim result As GUIListItem = New GUIListItem(starttime.ToString("MM/dd/yyyy hh:mm tt"))
    115.  
    116. result.Label += StrDup(6 - channel.Length, "_") + channel + " " + channeldisplayname
    117.  
    118. result.IconImage = "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png"
    119.  
    120. result.Label2 = series
    121.  
    122. result.Label3 = season + "." + episodenumber + " " + episode
    123.  
    124. 'AddHandler result.OnItemSelected, New GUIListItem.ItemSelectedHandler(AddressOf myOnItemselected)
    125.  
    126. Return result
    127.  
    128. End Function
    129.  
    130. End Class
    131.  
     
    Last edited: November 20, 2016
  11. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,695
    Likes Received:
    2,684
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,644 / 30
    Home Country:
    Ukraine Ukraine
    Show System Specs
    Here I can hardly help. Sory :(
     
Loading...
Similar Threads - Guicontrolsdemo whereever are
  1. DieBagger
    Replies:
    8
    Views:
    4,956

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!