Initializing GUILabelControl (1 Viewer)

jAxx

Portal Member
April 2, 2006
12
2
Aarhus
Home Country
Denmark Denmark
I have just read the "How to write a plugin for Media Portal" guide and it says:
Note you can use this for any control, for example a label control could be mapped by:
[SkinControlAttribute(1)] protected GUILabelControl lblText=null;

I want to be able to change the text of a label, but since lblText isn't initialized it can't be used. I searched the forum and found that you should use the GetControl method. So my code looks like:

Code:
[SkinControlAttribute(1)]
        protected GUILabelControl lblText = (GUILabelControl)GetControl(1);

But I get this error:
Error 1 An object reference is required for the nonstatic field, method, or property 'MediaPortal.GUI.Library.GUIWindow.GetControl(int)' D:\Docs\Code\- C#\MyMPPlugin\MyMPPlugin\Class1.cs 40 62 MyMPPlugin

Am I missing a reference? Any help is appreciated :)
 

jAxx

Portal Member
April 2, 2006
12
2
Aarhus
Home Country
Denmark Denmark
Problem solved... There is an error in the XML file in the "How to write a plugin for Media Portal" guide by Frodo.

The two images an the label all have id = 1.

No wonder I wasn't able to manipulate the label :) For others who are messing around with the guide: Just make sure all your elements in the XML file have unique ID's.
 

Users who are viewing this thread

Top Bottom