Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joetesta
Roku Guru

Rowlist focusBitmapUri offset on first focus

Hello,

Is this a problem with the 9 patch I'm using, is there an example app with a "good" 9 patch I can test against?

I'm trying to use a custom 9 patch for focusBitmapUri in a rowlist and seeing that every time the rowlist gets focus the first time, the selector is offset a bit to the left.  Any navigation from there gets the selector in the correct position.
Trying to figure out what's going on here, I took the Example Rowlist app, included my 9 patch and modified "rowlistscene.xml" like so:
<?xml version = "1.0" encoding = "utf-8" ?> 

<!--********** Copyright 2016 Roku Corp.  All Rights Reserved. **********-->

<component name = "RowListExample" extends = "Scene" initialFocus = "mybutton" >

  <script type = "text/brightscript" >

    <![CDATA[

    sub init()
      m.top.backgroundURI = "pkg:/images/rsgde_bg_hd.jpg"

      m.rowlist = m.top.findNode("exampleRowList")

      mybutton = m.top.findnode("mybutton")
      mybutton.observeField("buttonSelected", "clicked")

      m.rowlist.content = CreateObject("roSGNode", "RowListContent")

      m.top.setFocus(true)
    end sub

    function clicked()
      ? " MyButton clicked :: setting focus on rowlist"
       if m.rowlist = invalid then m.rowlist = m.top.getchild(1)
       m.rowlist.setFocus(true)
    end function

    ]]>

  </script>

  <children >

      <Button id="mybutton" minwidth="300" height="100" text="click me" translation = "[ 130, 30 ]"  />
      <RowList 
        id = "exampleRowList" 
        translation = "[ 130, 160 ]" 
        itemComponentName = "RowListItem" 
        numRows = "4" 
        itemSize = "[ 1608, 308 ]" 
        rowItemSize = "[ [512, 288] ]" 
        rowItemSpacing = "[ [40, 0] ]"
        itemSpacing = "[ 0, 40 ]" 
        showRowLabel = "[ true ]" 
        focusBitmapUri="pkg:/images/highlight_focus.9.png" />

  </children>

</component>


and commented out the scaling in "rowlistitem.xml"
    sub showfocus()
      'scale = 1 + (m.top.focusPercent * 0.08)
      'm.itemposter.scale = [scale, scale]
    end sub



It has the exact same problem - on first focus to the rowlist, the custom focusBitmapUrl is offset to the left and any navigation corrects it. 



Is this a problem with the 9 patch I'm using, is there something else going on?  Any suggestions?
tyvmia
Joe
aspiring
Tags (1)
0 Kudos
4 REPLIES 4
joetesta
Roku Guru

Re: Rowlist focusBitmapUri offset on first focus

fwiw toggling focus on first entry corrects it;
    function clicked()
      ? " MyButton clicked :: setting focus on rowlist"
       m.rowlist.setFocus(true)
       mybutton = m.top.findnode("mybutton")
       mybutton.setFocus(true)
       m.rowlist.setFocus(true)
    end function


Maybe need to do this anywhere there's a rowlist with a custom focusBitmapUri ?
aspiring
Tags (1)
0 Kudos
joetesta
Roku Guru

Re: Rowlist focusBitmapUri offset on first focus

Update: this bug is affected by rowFocusAnimationStyle, seems this only happens when using the default "floatingFocus" and using "fixedFocusWrap" prevents the bug.
Wonder if this is something that might be corrected?
aspiring
Tags (1)
0 Kudos
BVatBBOD
Visitor

Re: Rowlist focusBitmapUri offset on first focus

Found another "workaround" solution....

m.rowlist.setFocus(true)
m.rowlist.setFocus(false)
m.rowlist.setFocus(true)


Seems to do the trick
Thanks to the guys over at the Roku Developers Slack chat who pointed me here and helped me come up with a solution!

See https://forums.roku.com/viewtopic.php?f=34&t=138220To join!
Join the Roku Developers Slack Workspace for quicker help and great dev collaboration: http://tiny.cc/nrdf0y
Tags (1)
0 Kudos
silentEngineer
Channel Surfer

Re: Rowlist focusBitmapUri offset on first focus

i need help for this too not the solutions mentioned are not working for me.

0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!