jf-roku/components/login/UserRow.brs
2020-03-22 15:40:47 -07:00

60 lines
1.3 KiB
Plaintext

sub init()
m.top.itemComponentName = "UserItem"
m.top.content = SetData()
m.top.observeField("itemSelected", "SetUser")
m.top.showRowLabel = [false]
updateSize()
m.top.setFocus(true)
end sub
sub updateSize()
dimensions = m.top.getScene().currentDesignResolution
border = 200
'm.top.translation = [border, border + 115]
textHeight = 80
itemWidth = 300
itemHeight = 364
m.top.visible = true
' Size of the individual rows
m.top.itemSize = [1660, itemHeight]
' Spacing between Rows
m.top.itemSpacing = [ 0, 40]
' Size of items in the row
m.top.rowItemSize = [ itemWidth, itemHeight ]
' Spacing between items in the row
m.top.rowItemSpacing = [ 40, 0 ]
end sub
function setData()
if m.top.itemContent = invalid then
data = CreateObject("roSGNode", "ContentNode")
return data
end if
userData = m.top.itemContent
data = CreateObject("roSGNode", "ContentNode")
row = data.CreateChild("ContentNode")
for each item in userData
row.appendChild(item)
end for
m.top.content = data
updateSize()
return data
end function
sub setUser()
m.top.userSelected = m.top.itemContent[m.top.rowItemFocused[1]].Name
end sub
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
return false
end function