NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 19 20 21 22 23 … 93 Next »
SimpleButtonListPlugin

 
  • 0 Vote(s) - 0 Average
SimpleButtonListPlugin
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#1
2010-07-26, 05:52 PM
Can anyone post a simple example of a plugin that extends from SimpleButtonListPlugin?

I think I understand the basics of it, with it holding a ref to a UiList object, but so far my fumbling hasn't resulted in a list appearing on screen Sad

Do we just use the uiList variable from the base class, or do we need to instantiate it somehow?

I've cut n pasted bits of the skin from the recordings screen; I assume I need <ListView> <ListItemNormal> etc elements?

What does PopulateList() do? It's sounds obvious, but I want to be sure. Should I add the list objects there? Does it only get called at plugin creation? How do I set each item's values? With the properties hashtable? Help Big Grin

I don't actually need anything fancy. I want to display a list, with a few lines of text per item. The user won't be selecting anything, it's view-only. Scrolling up and down the items will be the limits of required functionality.

Thanks

Iain
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 107,099
Threads: 771
Joined: Nov 2003
#2
2010-07-26, 06:00 PM
I dont have a sample using this base class at the moment.

In general though, its the same as SimpleButtonPlugin, but you'd override the PopulateList() method and do something like this:

Code:
protected override void PopulateList()
        {
            List<UiList.ListObject> listObjects = new List<UiList.ListObject>();

            if (activeList == LIST_RECURRING)
            {
                List<RecurringRecording> recurringRecordings = RecurringRecording.LoadAll();
                foreach (RecurringRecording recurringRecording in recurringRecordings)
                {  
                    UiList.ListItem item = new UiList.ListItem();
                    item["@titleSubtitle"] = recurringRecording.Name;
                    item["@name"] = recurringRecording.Name;
                    item["@status"] = "Recurring";
                    item["@channel"] = recurringRecording.Channel.Name;                    
                    item["@recurringRecording"] = recurringRecording;
                    item["@failureReason"] = "";
                    item["@oid"] = recurringRecording.OID.ToString();


                    item["@period"] = recurringRecording.StartTime.ToLocalTime().ToShortDateString() + " " + recurringRecording.StartTime.ToLocalTime().ToShortTimeString() + " - " + recurringRecording.EndTime.ToLocalTime().ToShortTimeString();
                    //recurringRecording.



                    listObjects.Add(item);
                }

            }
            else
            {
                etc....
            }

            uiList.SetListObjects(listObjects, 0);
        }
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#3
2010-07-26, 09:11 PM
Thanks sub.

It seems my mistake was to try to do item.properties["@name"]= rather than item["@name"]=

Serves me right for thinking in Java...

Iain
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 107,099
Threads: 771
Joined: Nov 2003
#4
2010-07-26, 09:12 PM
From memory you can do that too.
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#5
2010-07-26, 09:43 PM
Not with my code Big Grin
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,721
Threads: 965
Joined: May 2006
#6
2010-07-26, 10:25 PM
WebRadio 3 was originally a SimpleButtonListPlugin, that became a NewStyleButtonListPlugin and it worked like sub's example Did you include base.NeedsRendering() and base.GetRenderList() ?

Martin
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#7
2010-07-27, 06:54 AM
sub's example was fine, and helped get my code running. I'm not 100% sure what I was doing wrong now - and the code is long gone - but nothing was appearing on screen. If I get a chance tonight, I'll copy it into a new demo class and post the entire thing for reference.

Iain
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#8
2010-07-27, 05:00 PM
Ok, this is very very simple, and does nothing but add a very ugly (and badly skinned Smile) list to the original SimpleButtonPlugin that was posted before, but it might be enough to help get people up and running with it...
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#9
2010-08-02, 07:25 PM
I'm afraid this post is now a massive plea for help! I've been banging my head against a wall for a couple of days now trying to make this work, but I'm getting nowhere :confused:

This all relates to the System plugin (http://forums.gbpvr.com//showthread.php?...Early-Beta).

I want to have two views: one is a list, the other is UiStatic. I want to display one or the other, based on the user's selection via the "View" button. The actual data they need to display is all working fine. The display updates periodically; currently every second for testing purposes.

I've attached my code; pretty much stripped to bone to leave just what I think is relevant to this problem. It extends from SimpleButtonListPlugin. I've also tried from SimpleButtonPlugin and defining the list myself. No matter how much faffing about with the code I try, I'm having the following problems:

- The buttons can lose their highlight/focus
- The list paints over/under the static
- The list won't update its data on a re-render
- The list counter still shows 1/0 even when I feed it no data

I'd appreciate any of you who understand the plugin architecture to have a quick look at it and see if you can work out what I'm doing wrong. There's only two classes worth looking at: NSystem (control class) and NSystemTuners (populates the list).

I'll shut up now to try and keep things simple... Rolleyes

Thanks
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 107,099
Threads: 771
Joined: Nov 2003
#10
2010-08-02, 07:49 PM
As a first change, try updating NSystem.cs to have:

Code:
public override bool NeedsRendering()
{
            bool needsRendering = base.NeedsRendering();
            if (uiStatus.NeedsRendering() || uiDrives.NeedsRendering() || uiList.NeedsRendering())
            {
                  needsRendering = true;
            }

            return needsRendering;
}

The reason for this is that some controls actually use the call to NeedsRendering() to update their internal state, and unfortunately in your existing code their is the likelihood that it wont be called on the base class.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode