Your Digital Media Has Never Looked So Good

 
newlvl
Topic Author
Posts: 7
Joined: Fri Aug 31, 2018 1:31 pm

Bug in Brightscript? Erroneous margins for a MarkupList inside LayoutGroup

Wed Oct 31, 2018 7:45 am

Hi,

While building my layout UI, I have encountered a very strange issue:

I have a MarkupList with my menu items. Its translation is [0,0].
 If I place it as a child of my component (or in a Group), everything is good - it appears at the right place.
But, the moment I put it as a child of a vertical LayoutGroup, it is presented with margins of 36 from both the left and the right sides.It seems to be specific for MarkupList as any other component behaves well.

As an example, we could take the canonical Roku MarkupListExample one (MarkupListExample.zip), taken from https://sdkdocs.roku.com/display/sdkdoc/MarkupList+Markup
and modify it:
First, set all the translations to [0,0] and observe that the list appears at the 0 X coordinate.
Then, wrap the MarkupList with a LayoutGroup and see that it suddenly gets a margin.


<?xml version = "1.0" encoding = "utf-8" ?>

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

<component name = "MarkupListExample" extends = "Scene" initialFocus = "exampleMarkupList" >

  <script type = "text/brightscript" >

    <![CDATA[

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

      example = m.top.findNode("exampleMarkupList")

      example.content = CreateObject("roSGNode", "MarkupListContent")

      examplerect = example.boundingRect()
      centerx = (1280 - examplerect.width) / 2
      centery = (720 - examplerect.height) / 2
      example.translation = [0 , 0 ]

      m.top.setFocus(true)
    end sub

    ]]>

  </script>

  <children >
 <LayoutGroup id="layoutGroup"
        translation="[0, 0]"
        layoutDirection = "horiz"
        horizAlignment = "left"
        addItemSpacingAfterChild = "false"
        itemSpacings = "[0]"
        vertAlignment = "top">
      <MarkupList
        id = "exampleMarkupList"
        itemComponentName = "MarkupListItem"
        itemSize = "[ 586, 154 ]"
        itemSpacing = "[ 0, 10 ]"
        drawFocusFeedback = "false"
        vertFocusAnimationStyle = "floatingFocus" />
  </LayoutGroup>
  
  </children>

</component>



Is it a bug?
Does anyone know how to put a MarkupList in a LayoutGroup without margins?

Thanks a lot
 
owen777
Posts: 16
Joined: Fri Nov 17, 2017 4:24 am

Re: Bug in Brightscript? Erroneous margins for a MarkupList inside LayoutGroup

Fri Aug 16, 2019 3:57 am

Yup, it's a bug - MarkupList adds dynamic translation when inside LayoutGroup.

Don't expect any answer from Roku ;)
 
User avatar
speechles
Posts: 169
Joined: Thu Aug 06, 2015 11:15 pm

Re: Bug in Brightscript? Erroneous margins for a MarkupList inside LayoutGroup

Sat Aug 24, 2019 4:16 pm

owen777 wrote:
Yup, it's a bug - MarkupList adds dynamic translation when inside LayoutGroup.

Don't expect any answer from Roku ;)

You can use a layoutgroup inside a layout group to get around that. Just nest the MarkupList into the double-nested layoutgroups which only have the markup list inside. 

<layout group id="lots of stuff">
    <layoutgroup id="myMarkupGroup" translation="[x,y]" ...>
        <layoutgroup id="myMarkupAdjuster" translation="[adjustX,adjustY]" >
            <markuplist ... />
        </layoutgroup>
    </layoutgroup>
    ... next layout group, etc
    ... until you run out of layout groups
</layoutgroup>

Adjust translation on nested layout group as required. There are other "things" you need to do this on too it isn't just MarkupList where the documentation is wrong.

Who is online

Users browsing this forum: No registered users and 2 guests