Your Digital Media Has Never Looked So Good

 
joetesta
Topic Author
Posts: 513
Joined: Wed Apr 20, 2011 11:48 am

Rowlist focusBitmapUri offset on first focus

Fri Jul 14, 2017 9:42 am

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. 

Image

Is this a problem with the 9 patch I'm using, is there something else going on?  Any suggestions?
tyvmia
Joe
aspiring
 
joetesta
Topic Author
Posts: 513
Joined: Wed Apr 20, 2011 11:48 am

Re: Rowlist focusBitmapUri offset on first focus

Fri Jul 14, 2017 10:14 am

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
 
joetesta
Topic Author
Posts: 513
Joined: Wed Apr 20, 2011 11:48 am

Re: Rowlist focusBitmapUri offset on first focus

Wed Jul 19, 2017 11:35 am

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

Who is online

Users browsing this forum: No registered users and 2 guests