Your Digital Media Has Never Looked So Good

 
svcmike
Topic Author
Posts: 19
Joined: Mon Jan 31, 2011 3:17 pm

Customize RSS Feed Background Color

Wed Feb 08, 2012 5:02 pm

Hi,

I have two RSS news feeds in my project. I want to manipulate them each a little differently. Here is an excerpt from my autorun.brs file:
Sub UpdateRSSStrings(zone as Object, playlistItem as Object)
    rssStringCount = zone.widget.GetStringCount()
    zone.widget.PopStrings(rssStringCount)
    article = playlistItem.rssParser.GetNextArticle()
    while type(article) = "roRssArticle"
   artdesc = ""
   if article.GetDescription() = "***" then
      zone.widget.SetBackgroundColor(&haaff0000)
   endif
   if article.GetDescription() <> "" then
      artdesc = ": " + article.GetDescription() + "..."
   endif
        zone.widget.PushString(article.GetTitle() + artdesc)
        article = playlistItem.rssParser.GetNextArticle()
    endwhile

End Sub

My first "if" statement is successfully turning the background of the zone to red if the description of the news article equals "***" which is what I want. However, I don't know how to return the background color of the zone to its normal color if the next news article's description does not equal "***". I could simply use zone.widget.SetBackgroundColor to explicitly put it back to the non-urgent color, but since this function is called for both of my RSS ticker zones I would wind up changing the background color on both zones which I don't want to do. So what I'm looking for is either a command to set the background color back to "normal" for that zone or a way to identify which zone I'm working on at the moment.

Any help would be appreciated.

Michael Keen
Southern Vermont College
 
RokuLyndon

Re: Customize RSS Feed Background Color

Thu Feb 09, 2012 4:55 pm

Depending on the brightauthor version you have, you might already have a zonename variable you can reference. Each zone you have has a name, you can change then name under the edit, layout tab..


In the new zone function, you can add this line before th ereturn zoneBS at the end to save the zone name under myzoneName$


    zoneBS.myzoneName$=zoneXML.name.GetText()
   
    return zoneBS
   
End Function



THen, when you want to reference the name in your code, you can add an if statement...

If ucase(zone.myzonename$) = "RSS-CUSTOM2" then

endif
 
svcmike
Topic Author
Posts: 19
Joined: Mon Jan 31, 2011 3:17 pm

Re: Customize RSS Feed Background Color

Tue Feb 14, 2012 1:36 pm

Hi Lyndon,

Thanks for your advice. I actually had it working, but then I decided to upgrade the firmware to 3.8.19 and BrightAuthor to 2.4.0.17 which is apparently quite different. Can I ask you to provide code on how to get the zonename variable on this newer platform?

Much appreciated.

EDIT: It also seems like the strategy for changing the background color, zone.widget.SetBackgroundColor(&haaff0000), is now also obsolete. Would you kindly provide the updated code for setting the background color of a zone? Thanks again.

Michael Keen
Southern Vermont College
 
svcmike
Topic Author
Posts: 19
Joined: Mon Jan 31, 2011 3:17 pm

Re: Customize RSS Feed Background Color

Mon Feb 27, 2012 5:09 pm

bump.
 
RokuLyndon

Re: Customize RSS Feed Background Color

Tue Feb 28, 2012 6:26 pm

There's already a name variable in the newer brightauthor autorun script. So, we don't have to add anything to newzone.

I believe you want to find this function:

Function STRSSLoadingEventHandler(event As Object, stateData As Object) As Object



and, this bit of code:

            m.stateMachine.rssItem.articles.Clear()
                        
            article = m.stateMachine.rssItem.rssParser.GetNextArticle()
            while type(article) = "roRssArticle"
               description = article.GetDescription()
               if m.stateMachine.rssItem.isTwitterFeed and m.bsp.stripTwitterUserNames and m.stateMachine.rssItem.twitterUserName$ <> "" then
                  description = Mid(description, len(m.stateMachine.rssItem.twitterUserName$))
               endif
               m.stateMachine.rssItem.articles.Push(description)
               article = m.stateMachine.rssItem.rssParser.GetNextArticle()
               
            endwhile



The statemachine referenced here is the zone. So, to find the name of the zone, you would check:

m.statemachine.name$
 
svcmike
Topic Author
Posts: 19
Joined: Mon Jan 31, 2011 3:17 pm

Re: Customize RSS Feed Background Color

Tue Feb 28, 2012 6:41 pm

Lyndon,
Thanks for this. Can I also ask you to respond to my other question about how to change the background color of a zone in the newer Brightauthor script?

Appreciate it.
 
RokuLyndon

Re: Customize RSS Feed Background Color

Tue Feb 28, 2012 8:08 pm

of a text zone? Text zones and live text fields have background color, but not image zones, for example.
 
svcmike
Topic Author
Posts: 19
Joined: Mon Jan 31, 2011 3:17 pm

Re: Customize RSS Feed Background Color

Tue Feb 28, 2012 9:29 pm

of a text zone? Text zones and live text fields have background color, but not image zones, for example.

Yes, my goal is ultimately to automatically change the background color of an RSS text feed zone for urgent messages (which have three asterisks in the description) and then change it back to the default zone background color on the next non-urgent news item in the feed.
 
svcmike
Topic Author
Posts: 19
Joined: Mon Jan 31, 2011 3:17 pm

Re: Customize RSS Feed Background Color

Fri Mar 09, 2012 8:13 am

bump

Who is online

Users browsing this forum: No registered users and 1 guest