Hi,
I know this is probably pretty simple, but I'm new to Roku, just need help correcting my SimpleGrid.brs file to:
1). Show an items "title" under the thumnail. Right now, its just showing the thumb, but no title. I disabled the overhang description. I just want the title to show under the thumb.
2) Also when I changed the gridstyle to : "flat-landscape" I get this huge gap at the top of the screen. I set the screen.SetFocusedListItem(1,0) and it looks fine when I load the channel, but when i scroll up, I still get the huge gap.
Any help would be very much appreciated! Thanks so much!
' *********************************************************
' ** Simple Grid Screen Demonstration App
' ** Jun 2010
' ** Copyright (c) 2010 Roku Inc. All Rights Reserved.
' *********************************************************
'************************************************************
'** Application startup
'************************************************************
Sub Main()
' init google analytics
InitGATracker("UA-1846090-3", "roku..com")
'Use this function to log a page view in Google Analytics
GATrackPageView("Loaded Roku App", "roku..com", "Roku")
'If PageTitle or PageURL are passed in empty, and one is not then the empty one will
'be set to the value of the other.
'"Page Title", "", "User Value" = "Page Title", "Page Title", "User Value"
'If both are empty they are set to "Roku"
'If User Value is empty it is set to "Roku"
'initialize theme attributes like titles, logos and overhang color
initTheme()
gridstyle = "flat-landscape"
'set to go, time to get started
while gridstyle <> ""
'print "starting grid style= ";gridstyle
screen=preShowGridScreen(gridstyle)
gridstyle = showGridScreen(screen, gridstyle)
end while
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'** These attributes affect the branding of the application
'** and are artwork, colors and offsets specific to the app
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
app.SetTheme(CreateDefaultTheme())
End Sub
'******************************************************
'** @return The default application theme.
'** Screens can make slight adjustments to the default
'** theme by getting it from here and then overriding
'** individual theme attributes.
'******************************************************
Function CreateDefaultTheme() as Object
theme = CreateObject("roAssociativeArray")
theme.ThemeType = "generic-dark"
' All these are greyscales
theme.GridScreenBackgroundColor = "#2a2a2a" '"#363636"
theme.GridScreenMessageColor = "#808080"
theme.GridScreenRetrievingColor = "#CCCCCC"
theme.GridScreenListNameColor = "#0099cc"
' Color values work here
theme.GridScreenDescriptionTitleColor = "#808080" '"#001090"
theme.GridScreenDescriptionDateColor = "#808080" '"#FF005B"
theme.GridScreenDescriptionRuntimeColor = "#808080" '"#5B005B"
theme.GridScreenDescriptionSynopsisColor = "#808080" '"#606000"
'used in the Grid Screen
'theme.CounterTextLeft = "#FF0000"
'theme.CounterSeparator = "#00FF00"
'theme.CounterTextRight = "#0000FF"
theme.GridScreenLogoHD = "pkg:/images/Overhang_Background_HD.png"
theme.GridScreenLogoOffsetHD_X = "0"
theme.GridScreenLogoOffsetHD_Y = "0"
theme.GridScreenOverhangHeightHD = "99"
theme.GridScreenLogoSD = "pkg:/images/Overhang_Background_SD.png"
theme.GridScreenOverhangHeightSD = "66"
theme.GridScreenLogoOffsetSD_X = "0"
theme.GridScreenLogoOffsetSD_Y = "0"
' to use your own focus ring artwork
theme.GridScreenFocusBorderSD = "pkg:/images/GridCenter_Border_Landscape_SD43.png"
theme.GridScreenBorderOffsetSD = "(0,0)" '"(-20,-20)"
theme.GridScreenFocusBorderHD = "pkg:/images/GridCenter_Border_Landscape_HD.png"
theme.GridScreenBorderOffsetHD = "(0,0)"' "(-25,-25)"
' to use your own description background artwork
theme.GridScreenDescriptionImageSD = "pkg:/images/Grid_Description_Background_SD43.png"
theme.GridScreenDescriptionOffsetSD = "(125,170)"
theme.GridScreenDescriptionImageHD = "pkg:/images/Grid_Description_Background_HD.png"
theme.GridScreenDescriptionOffsetHD = "(190,255)"
theme.BackgroundColor = "#2a2a2a"
theme.ButtonHighlightColor = "#808080"
theme.ButtonNormalColor = "#808080"
theme.OverhangPrimaryLogoHD = "pkg:/images/Overhang_Background_HD.png"
theme.OverhangPrimaryLogoOffsetHD_X = "0"
theme.OverhangPrimaryLogoOffsetHD_Y = "0"
theme.OverhangPrimaryLogoSD = "pkg:/images/Overhang_Background_SD.png"
theme.OverhangPrimaryLogoOffsetSD_X = "0"
theme.OverhangPrimaryLogoOffsetSD_Y = "0"
return theme
End Function
'******************************************************
'** Perform any startup/initialization stuff prior to
'** initially showing the screen.
'******************************************************
Function preShowGridScreen(style as string) As Object
m.port=CreateObject("roMessagePort")
screen = CreateObject("roGridScreen")
screen.SetMessagePort(m.port)
' screen.SetDisplayMode("best-fit")
screen.SetDisplayMode("scale-to-fill")
screen.SetGridStyle(style)
return screen
End Function
'******************************************************
'** Display the gird screen and wait for events from
'** the screen. The screen will show retreiving while
'** we fetch and parse the feeds for the show posters
'******************************************************
Function showGridScreen(screen As Object, gridstyle as string) As string
print "enter showGridScreen"
GATrackPageView("Display Roku Main Screen", "roku..com/main", "Roku")
categoryList = getCategoryList()
screen.setupLists(categoryList.count())
screen.SetListNames(categoryList)
screen.SetDescriptionVisible(false)
screen.SetFocusedListItem(1,0)
' list holders
showListFilms = CreateObject("roAssociativeArray")
showListComposers = CreateObject("roAssociativeArray")
showListVideogames = CreateObject("roAssociativeArray")
' get lists
showListFilms = getShowsForCategoryFilm(categoryList[0])
showListComposers = getShowsForCategoryComposers(categoryList[1])
showListVideogames = getShowsForCategoryVideogames(categoryList[2])
' push lists to screen grid
screen.SetContentList(0, showListFilms)
screen.SetContentList(1, showListComposers)
screen.SetContentList(2, showListVideogames)
screen.Show()
while true
print "Waiting for message"
msg = wait(0, m.port)
'msg = wait(0, screen.GetMessagePort()) ' getmessageport does not work on gridscreen
print "Got Message:";type(msg)
if type(msg) = "roGridScreenEvent" then
print "msg= "; msg.GetMessage() " , index= "; msg.GetIndex(); " data= "; msg.getData()
if msg.isListItemFocused() then
print"list item focused | current show = "; msg.GetIndex()
else if msg.isListItemSelected() then
row = msg.GetIndex()
selection = msg.getData()
print "list item selected row= "; row; " selection= "; selection
if(row = 0)
m.curShow = displayShowDetailScreen(showListFilms, selection)
endif
if(row = 1)
m.curShow = displayShowDetailScreen(showListComposers, selection)
endif
if(row = 2)
m.curShow = displayShowDetailScreen(showListVideogames, selection)
endif
else if msg.isScreenClosed() then
return ""
end if
end If
end while
End Function
'**********************************************************
'** When a poster on the home screen is selected, we call
'** this function passing an roAssociativeArray with the
'** ContentMetaData for the selected show. This data should
'** be sufficient for the springboard to display
'**********************************************************
Function displayShowDetailScreen(category as Object, showIndex as Integer) As Integer
'showVideoScreen(category[showIndex])
showDetailScreen(category[showIndex])
return 1
End Function
'**************************************************************
'** Return the list of categories to display in the filter
'** banner. The result is an roArray containing the names of
'** all of the categories. All just static data for the example.
'***************************************************************
Function getCategoryList() As Object
categoryList = [ "Latest News", "The Rundown", "Editors' Picks"]
return categoryList
End Function
'********************************************************************
'** Given the category from the filter banner, return an array
'** of ContentMetaData objects (roAssociativeArray's) representing
'** the shows for the category. For this example, we just cheat and
'** create and return a static array with just the minimal items
'** set, but ideally, you'd go to a feed service, fetch and parse
'** this data dynamically, so content for each category is dynamic
'********************************************************************
Function getShowsForCategoryFilm(category As Object) As Object
print "getting shows for category "; category
conn = InitShowFeedConnectionFilmSound()
showListFilms = conn.LoadShowFeed(conn)
return showListFilms
End Function
Function getShowsForCategoryComposers(category As Object) As Object
print "getting shows for category "; category
conn = InitShowFeedConnectionComposers()
showListComposers = conn.LoadShowFeed(conn)
return showListComposers
End Function
Function getShowsForCategoryVideogames(category As Object) As Object
print "getting shows for category "; category
conn = InitShowFeedConnectionVideogames()
showListVideogames = conn.LoadShowFeed(conn)
return showListVideogames
End Function