| |||||||
| Plugins Plugins developed and maintained by users. Want to create your own plugin? Start a thread in here. |
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Portal Member Join Date: Mar 2005 Location: Melb, Aus Age: 27
Posts: 408
Thanks: 0
Thanked 0 Times in 0 Posts
Country: | i'm wanting to add a button to an existing screen (myvideosinfo), which when clicked runs a function from my process plugin. at the moment the way i'm doing this is manually adding the button to the skin xml and giving it a new id (say 5555). then in the plugin Start() function i've got a line: GUIWindowManager.Receivers += new SendMessageHandler(OnMessage); the OnMessage function looks like this: private void OnMessage(GUIMessage message) { if (message.Message == GUIMessage.MessageType.GUI_MSG_CLICKED && message.SenderControlId == 5555) { // run my function } } is this the correct way of doing this? is there a better way? |
| | |
| | #2 (permalink) | |
| Portal Member Join Date: Apr 2005 Location: Southeast Age: 36
Posts: 606
Thanks: 6
Thanked 35 Times in 24 Posts
Country: | Quote:
they way I have usually seen it done is to put it into the override of OnClicked and check the control. (If you are changing code in an existing plugin the override is probably already there) So after you add the button to the skin.xml file something like the code below should work. Code: [SkinControlAttribute(5555)] protected GUIButtonControl btnRunMyProcessPlugin = null;
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
{
base.OnClicked(controlId, control, actionType);
if (control == btnSomeOtherButton)
{
//
}
else if (control == btnRunMyProcessPlugin)
{
// Insert code here
}
}
patrick | |
| | |
| | #3 (permalink) |
| Portal Member Join Date: Mar 2005 Location: Melb, Aus Age: 27
Posts: 408
Thanks: 0
Thanked 0 Times in 0 Posts
Country: | i just tried putting the code you suggested in the plugin but i'm getting a compilation error: "'MyHTTrailers.Class1.OnClicked(int, MediaPortal.GUI.Library.GUIControl, MediaPortal.GUI.Library.Action.ActionType)': no suitable method found to override C:\Documents and Settings\Nyall\My Documents\Visual Studio 2005\Projects\MyHTTrailers\MyHTTrailers\Class1.cs 267 33 MyHTTrailers " is there something I'm missing? |
| | |
| | #5 (permalink) |
| Portal Member Join Date: Mar 2005 Location: Melb, Aus Age: 27
Posts: 408
Thanks: 0
Thanked 0 Times in 0 Posts
Country: | ok - i got it to compile but the OnClicked function isn't triggering. is this because my plugin is a process plugin which i'm trying to trigger from another skin page, and doesn't have it's own page? also - is there any way to add an item to an existing mp context menu from a plugin? thanks for all the assistance btw! |
| | |
| | #6 (permalink) | ||
| Portal Member Join Date: Apr 2005 Location: Southeast Age: 36
Posts: 606
Thanks: 6
Thanked 35 Times in 24 Posts
Country: | Quote:
I thought you were creating or modifying the code in a windows plugin to start something in a process plugin when you said adding a button to an existing screen. So pretty much ignore everything I said... It looks like you were doing it right. The only other thing you may want to do is check if the current window is the window you added the button to so you do not act on the clicks on any button with id=5555. Quote:
Again, sorry I caused you extra work. patrick | ||
| | |
![]() |
| Bookmarks |
| Tags |
| button, click, plugin, processing |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [BUG] Unable to scan TV chanels and radio | Bram | pre 1.0 RC1 | 0 | 2006-11-05 14:45 |
| Issue with My TV, My Videos and Web Browser | Efros | The old Bugreport Forum | 15 | 2006-05-15 22:01 |
| After first time entering .apefolder all files is unknown. | PHN2 | The old Bugreport Forum | 1 | 2006-03-15 17:28 |
| Gathering topical infos about plugins (To: authors & use | tomtom21000 | Plugins | 2 | 2006-02-05 00:20 |
| Plugin example doesnt show in list | Anonymous | Plugins | 5 | 2005-08-13 12:12 |