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 2007-02-04, 09:23   #1 (permalink)
Portal Member
 
Join Date: Jul 2006
Location: Lower Hutt
Posts: 156
Thanks: 1
Thanked 2 Times in 2 Posts

Country:

My System

Default Plugin strings and keys...

According to the Plugin tutorial, I can define strings for my GUI either by putting the text in the control's XML (<label>The string</label>), or by specifying a string Id within strings.xml (<label>73</label>).

Are these the only options? Obviously, the former method means that translations won't be possible, and the latter means the user has to mess with their strings.xml(s) when installing the plugin; neither of these is really satisfactory...

Likewise for keymap.xml - I want to override the default actions for some (most!) keys (only for my plugin, of course), but the only way I've found to make this work is for the user to manually cut-and-paste a section into keymap.xml for my plugin's GUI; again, this seems heavy-handed, and makes un/re-installing the plugin rather problematic. Also, each time the user upgrades or reinstalls MP, they will have to go through the same painful process again.

It'd be nice if I could define <keys>...</keys> in the gui xml, and possibly have multiple <string></string> entries (one for each language, maybe defaulting to the first if the user-selected language is not found)...

Or have I just missed the obvious, already present way to do these things? Given that my C# is fairly elementary so far this wouldn't surprise me...
TesterBoy is offline   Reply With Quote
Old 2007-02-04, 13:36   #2 (permalink)
Portal Designer
 
Inker's Avatar
 
Join Date: Dec 2004
Posts: 1,560
Thanks: 35
Thanked 134 Times in 58 Posts

My System

Default

Well, for overwriting keys....I don't think you should overwrite them. Generally you would react to ACTIONS (which are caused by the user pressing whatever key, be it on the remote or keyboard, that the user has assigned to that ACTION. In the plugin you then intercept the ACTION (and not a keypress directly) and react accordingly.

Lets say you wanted to do something when the user presses stop (which defaults to the 'b' button the keyboard, but the user can overwrite this in the configuration to whatever key he/she wants. The code would look something like this:

Code:
public override void OnAction(Action action)
{
  switch (action.wID)
            {
                case Action.ActionType.ACTION_STOP:
                           // do whatever here
                           break;
                default:
                          // let MP handle all other actions
                          base.OnAction(action);
                          break;
            }
}
__________________

There are only two industries that refer to their customers as "users".
- Edward Tufte
Inker is offline   Reply With Quote
Old 2007-02-04, 20:31   #3 (permalink)
Portal Member
 
Join Date: Jul 2006
Location: Lower Hutt
Posts: 156
Thanks: 1
Thanked 2 Times in 2 Posts

Country:

My System

Default

The thing is, I don't want the key to actually do anything except be a 'b' - the user is typing text into the plugin, and when the 'b' key is pressed I don't want the video to stop -I just want to get a 'b' so I can add it to the string. If I override the mapping in keymap to -1, this works perfectly (except the '!' still does the frame-rate etc)...
TesterBoy is offline   Reply With Quote
Old 2007-02-05, 07:23   #4 (permalink)
Portal Member
 
Join Date: Aug 2004
Location: Melbourne, Australia
Posts: 773
Thanks: 0
Thanked 0 Times in 0 Posts


Default

What if you don't call
Code:
base.OnAction(action);
at the end of your OnAction handler?

Just a stab in the dark, no testing done.

Sam
samuel337 is offline   Reply With Quote
Reply

Bookmarks

Tags
keys, plugin, strings

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
My Keys Plugin mPod Plugins 69 2008-02-07 15:13
How do I get a Plugin ID and strings.xml? falkyre Plugins 6 2006-04-09 21:39
How do I add strings to strings.xml? CodeMonkey Plugins 3 2006-02-23 08:44
Missing strings in the strings.xml file. Anonymous General Development (no feature request here!) 5 2005-01-05 10:21


All times are GMT +1. The time now is 05:02.


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