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
Development
General Development (no feature request here!)
vb.net & GUIFacadeControl problem
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="bpell" data-source="post: 644763" data-attributes="member: 106216"><p>I'm new to developing for MediaPortal as of yesterday (Vb.Net) so excuse some of my ignorance of the internals. It looks like first that you're not returning anything from the getSelectedItem and there is no "ByRef" variable. I suspect you want to use a Function to return the selected value. Here's an example from another control, it's an extension method I created, as you can see, it returns a String value (or an Int value) based on the selected item in the dialog that I create. This is a different dialog than you're using, but the principle is the same.</p><p></p><p>[code]</p><p>Imports System.Runtime.CompilerServices</p><p>Imports System.Windows.Forms</p><p>Imports MediaPortal.GUI.Library</p><p>Imports MediaPortal.Dialogs</p><p></p><p>''' <summary></p><p>''' Extension methods for MediaPortal.</p><p>''' </summary></p><p>''' <remarks></remarks></p><p>Public Module MediaPortalExtensions</p><p></p><p> ''' <summary></p><p> ''' Shows a context menu with it's items populated from a string array, then returns the selected index in that list.</p><p> ''' </summary></p><p> ''' <param name="win"></param></p><p> ''' <param name="menuItems"></param></p><p> ''' <param name="header"></param></p><p> ''' <returns>The selected index of the item choosen. If no item is choosen or the dialog window is null a -1 will be returned.</returns></p><p> ''' <remarks></p><p> ''' The selected index maybe useful if you need to match that back to a list of objects that contain more information than</p><p> ''' just a string title.</p><p> ''' </remarks></p><p> <Extension()> _</p><p> Public Function ShowContextMenuToInt(ByVal win As GUIWindow, ByVal menuItems() As String, ByVal header As String) As Integer</p><p> Dim dlgMenu As GUIDialogMenu = GUIWindowManager.GetWindow(GUIWindow.Window.WINDOW_DIALOG_MENU)</p><p></p><p> If dlgMenu IsNot Nothing Then</p><p> dlgMenu.Reset()</p><p> dlgMenu.SetHeading(header)</p><p> For Each item As String In menuItems</p><p> dlgMenu.Add(item)</p><p> Next</p><p> dlgMenu.DoModal(win.GetID)</p><p></p><p> Return dlgMenu.SelectedLabel</p><p> Else</p><p> Return -1</p><p> End If</p><p> End Function</p><p></p><p> ''' <summary></p><p> ''' Shows a context menu with it's items populated from a string array, then returns the selected displayed string.</p><p> ''' </summary></p><p> ''' <param name="win"></param></p><p> ''' <param name="menuItems"></param></p><p> ''' <param name="header"></param></p><p> ''' <returns>The string value of the item selected, if no item is selected or the dialog window is null a blank string is returned.</returns></p><p> ''' <remarks></remarks></p><p> <Extension()> _</p><p> Public Function ShowContextMenuToString(ByVal win As GUIWindow, ByVal menuItems() As String, ByVal header As String) As String</p><p> Dim dlgMenu As GUIDialogMenu = GUIWindowManager.GetWindow(GUIWindow.Window.WINDOW_DIALOG_MENU)</p><p></p><p> If dlgMenu IsNot Nothing Then</p><p> dlgMenu.Reset()</p><p> dlgMenu.SetHeading(header)</p><p> For Each item As String In menuItems</p><p> dlgMenu.Add(item)</p><p> Next</p><p> dlgMenu.DoModal(win.GetID)</p><p></p><p> Return dlgMenu.SelectedLabelText</p><p> Else</p><p> Return ""</p><p> End If</p><p> End Function</p><p></p><p>End Module</p><p></p><p>[/code]</p></blockquote><p></p>
[QUOTE="bpell, post: 644763, member: 106216"] I'm new to developing for MediaPortal as of yesterday (Vb.Net) so excuse some of my ignorance of the internals. It looks like first that you're not returning anything from the getSelectedItem and there is no "ByRef" variable. I suspect you want to use a Function to return the selected value. Here's an example from another control, it's an extension method I created, as you can see, it returns a String value (or an Int value) based on the selected item in the dialog that I create. This is a different dialog than you're using, but the principle is the same. [code] Imports System.Runtime.CompilerServices Imports System.Windows.Forms Imports MediaPortal.GUI.Library Imports MediaPortal.Dialogs ''' <summary> ''' Extension methods for MediaPortal. ''' </summary> ''' <remarks></remarks> Public Module MediaPortalExtensions ''' <summary> ''' Shows a context menu with it's items populated from a string array, then returns the selected index in that list. ''' </summary> ''' <param name="win"></param> ''' <param name="menuItems"></param> ''' <param name="header"></param> ''' <returns>The selected index of the item choosen. If no item is choosen or the dialog window is null a -1 will be returned.</returns> ''' <remarks> ''' The selected index maybe useful if you need to match that back to a list of objects that contain more information than ''' just a string title. ''' </remarks> <Extension()> _ Public Function ShowContextMenuToInt(ByVal win As GUIWindow, ByVal menuItems() As String, ByVal header As String) As Integer Dim dlgMenu As GUIDialogMenu = GUIWindowManager.GetWindow(GUIWindow.Window.WINDOW_DIALOG_MENU) If dlgMenu IsNot Nothing Then dlgMenu.Reset() dlgMenu.SetHeading(header) For Each item As String In menuItems dlgMenu.Add(item) Next dlgMenu.DoModal(win.GetID) Return dlgMenu.SelectedLabel Else Return -1 End If End Function ''' <summary> ''' Shows a context menu with it's items populated from a string array, then returns the selected displayed string. ''' </summary> ''' <param name="win"></param> ''' <param name="menuItems"></param> ''' <param name="header"></param> ''' <returns>The string value of the item selected, if no item is selected or the dialog window is null a blank string is returned.</returns> ''' <remarks></remarks> <Extension()> _ Public Function ShowContextMenuToString(ByVal win As GUIWindow, ByVal menuItems() As String, ByVal header As String) As String Dim dlgMenu As GUIDialogMenu = GUIWindowManager.GetWindow(GUIWindow.Window.WINDOW_DIALOG_MENU) If dlgMenu IsNot Nothing Then dlgMenu.Reset() dlgMenu.SetHeading(header) For Each item As String In menuItems dlgMenu.Add(item) Next dlgMenu.DoModal(win.GetID) Return dlgMenu.SelectedLabelText Else Return "" End If End Function End Module [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
vb.net & GUIFacadeControl problem
Contact us
RSS
Top
Bottom