Your Digital Media Has Never Looked So Good

Topic Author
Posts: 5
Joined: Fri Oct 19, 2018 12:35 pm

MarkupGrid fixedLayout true "Ghosts" Cells

Fri Feb 01, 2019 9:16 am

Hi everyone!,  I have a trouble with MarkupGrid fixedlayout, this is a example project where I reproduce the problem. The purpose of the project is to show a grid with two rows with 5 items each. This works if you have numColumns=5 (property value assigned on SimpleMarkupListScene.brs ln 16) . If I set numColumns=4, I expect that the last column will hide and I can scroll horizontally to it (I'm wrong?, this happens if I add multiple items on one row, just one row) but I got errors about cells already occupied. I added some comments on the code about the issues.

Let me know what you think, Thanks!

function init()
    m.simpleMarkupGrid ="SimpleMarkupGrid")
    m.simpleMarkupGrid.content = getGridData()
end function

function onKeyEvent(key as String, press as Boolean) as Boolean
    handled = false
    return handled
end function

function getGridData() as object

    data = CreateObject("roSGNode", "ContentNode")

    m.simpleMarkupGrid.numColumns = 5
    'if we have rows = 1, items = 10 and numColumns = 5 we can scroll horizontally
    'if we have rows = 2, items = 5 and numColumns = 4 we have "cell was already occupied" errors
    'if we have rows = 2, items = 5 and numColumns = 5 we can see a 2x5 grid    
    rows = 2
    items = 5

    for i=0 to rows-1
        for j=0 to items -1
            dataItem = data.CreateChild("ItemData")
            dataItem.text = stri(j) + "," + stri(i)
            dataItem.X = j
            dataItem.Y = i
            dataItem.W = 1
            dataItem.H = 1
        end for
    end for

    ' I can't add an item on the row [0,1]  or [1,1], etc, because there is a "cell" already there if the numColumns is 4, Why is this?
'    ------ Running dev 'Simple MarkupList' main ------
'    ** Error - ArrayGrid: Fixed Layout cell was already occupied
'        cell 4, current item: 4, new item: 5
'        Row (Y): 1 Column (X): 0 Width (W):1 Height (H): 1

    return data
end function

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

<component name="SimpleMarkupListScene" extends="Scene" >

<script type="text/brightscript" uri="pkg:/components/SimpleMarkupListScene.brs" />

   drawFocusFeedback = "false"


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

<component name="ItemData" extends="ContentNode">

  <field id="text" type="string" />


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

<component name="Item" extends="Group">

  <field id="itemContent" type="node" onChange="itemContentChanged"/>
  <field id = "focusPercent" type = "float" onChange = "showfocus"/>
  <field id = "rowFocusPercent" type = "float" onChange = "showrowfocus"/>

<script type="text/brightscript" >
  function itemContentChanged()
    itemData =

    m.text.text = itemData.text

    m.boundRect ="boundingRect")
    m.boundRect.width *= itemData.W
  end function

  function init()
    m.text ="text")
  end function

  function showfocus()
   if = 1 then
         m.boundRect.opacity = 1
         if > .5 then
            m.boundRect.opacity =
            m.boundRect.opacity = .5
         end if
      end if
  end function

  function showrowfocus()

  end function

         <Label id="text"


Who is online

Users browsing this forum: No registered users and 6 guests